Closed
Description
Using pandas 0.14, the slicing changed strangely. I can slice rows using start/end with an integer index, but not a float index:
In [18]: df = pandas.DataFrame(np.random.randn(10, 5), index=np.arange(10, 20))
In [19]: df
Out[19]:
0 1 2 3 4
10 -1.878123 -0.581537 0.189536 0.173014 0.132059
11 1.229246 -0.988689 0.632404 0.939126 -0.186367
12 0.376735 0.329723 1.480293 -0.209164 0.080897
13 0.461558 0.303541 -0.669196 -1.032077 1.634512
14 -0.972455 0.657357 -0.566609 0.154165 -0.561543
15 -2.502244 1.022540 -1.019376 -0.934582 1.751852
16 -1.875567 0.504288 -0.524922 0.048277 -1.587904
17 0.636652 0.441224 -1.391552 0.650876 0.374673
18 -1.503102 0.822411 1.776667 -0.879583 1.035291
19 -0.620467 0.319855 -0.779280 -0.168827 0.502470
In [20]: df[3:5]
Out[20]:
0 1 2 3 4
13 0.461558 0.303541 -0.669196 -1.032077 1.634512
14 -0.972455 0.657357 -0.566609 0.154165 -0.561543
In [21]: df.index = [float(x) for x in df.index]
In [22]: df
Out[22]:
0 1 2 3 4
10 -1.878123 -0.581537 0.189536 0.173014 0.132059
11 1.229246 -0.988689 0.632404 0.939126 -0.186367
12 0.376735 0.329723 1.480293 -0.209164 0.080897
13 0.461558 0.303541 -0.669196 -1.032077 1.634512
14 -0.972455 0.657357 -0.566609 0.154165 -0.561543
15 -2.502244 1.022540 -1.019376 -0.934582 1.751852
16 -1.875567 0.504288 -0.524922 0.048277 -1.587904
17 0.636652 0.441224 -1.391552 0.650876 0.374673
18 -1.503102 0.822411 1.776667 -0.879583 1.035291
19 -0.620467 0.319855 -0.779280 -0.168827 0.502470
In [23]: df[3:5]
Out[23]:
Empty DataFrame
Columns: [0, 1, 2, 3, 4]
Index: []
In [24]: df.index
Out[24]: Float64Index([10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0], dtype='float64')
In [25]: pandas.__version__
Out[25]: '0.14.0'
Was this an intentional change, or a bug?