python - Index Slicing with Float64Index not working in pandas -
After
I have the following dataframe
p12Diff pump time 3 -2.90 -0,00, 919-2.89 - 0.000795-288-0000814-287-0000700-2,86-0,0847-2,85-0,0769-284-0,0681-2,83 - 0,000888 -2,82 -0,000815-2,81 -0,000764-2,80,000,879 -2,70 -0,000757-2,60-0,0758-2,50 -0, 000707 idx = IndexSlice for some categories, I get a keyError , whereas for others it only works For example, df.loc [idx [, - 2.90: -2.52] ,:] -2.60, while df.loc [idx [, - 2.90: -2.62] ]:] wakes up Is keyError: -2.62 . Is this a bug?
It was fixed for 0.15.0 (RC1 is now out), see here: . . 0.14.1 There was a car with this type of indexing
in [13]: DF = DataFrame ({'value': np.arange (11)}, index = pd.multiIndex .from_product ([[1], np.linspace (-2.9, -2.3, 11)])) [14] in: df out [14]: value 1 -290 0 -2,84 1-278 2 -272 3 -2,66 4 -2,60 5 -2,54 6 -2, 48, 7, 2, 8, 2, 36, 9, 2, 10 [15]: IDX = pd. IndexSlice in [16]: df.loc [IDX [: - 2.9: -2.42],] Out [16]: Price 1 -290 0 -2,84 1 -278 2 -272 3 -2 , 66 4 -260 5 -2,54 6 -2,48 7 -2,42 in [17]: df.loc [IDX [: - 2.9: -2.52], Out [17]: Value 1 - 2.90 0 -2.84 1 -2.78 2 -2.72 3 -2.66 4 -2.60 5 -2.54 6 in [18]: df.loc [idx [, - 2.84: - 2.52], [18]: value 1 -2.84 1 - 2.78 2 -2.72 3 -2.66 4 -2.60 5 -2.54 6 in [19]: df.loc [idx [:, - 2.85: -2.52],] Out [19]: Value 1 -2.84 1 -2.78 2 -2.72 3 -2.66 4 -2.60 5 -2.54 6
Comments
Post a Comment