You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v0.16.0.txt
+17-9
Original file line number
Diff line number
Diff line change
@@ -322,24 +322,32 @@ The behavior of a small sub-set of edge cases for using ``.loc`` have changed (:
322
322
In [6]: s.loc[-10:3]
323
323
KeyError: 'start bound [-10] is not the [index]'
324
324
325
-
In [8]: s.loc[-1.0:2]
326
-
Out[2]:
327
-
-1 1
328
-
1 2
329
-
2 3
330
-
dtype: int64
331
-
332
325
New Behavior
333
326
334
327
.. ipython:: python
335
328
336
329
df.loc['2013-01-02':'2013-01-10']
337
330
s.loc[-10:3]
338
331
332
+
- allow slicing with float-like values on an integer index for ``.ix``. Previously this was only enabled for ``.loc``:
333
+
339
334
.. code-block:: python
340
335
341
-
In [8]: s.loc[-1.0:2]
342
-
TypeError: cannot do slice indexing on <class 'pandas.core.index.Int64Index'> with these indexers [-1.0] of <type 'float'>
336
+
Previous Behavior
337
+
338
+
In [8]: s.ix[-1.0:2]
339
+
TypeError: the slice start value [-1.0] is not a proper indexer for this index type (Int64Index)
340
+
341
+
New Behavior
342
+
343
+
.. ipython:: python
344
+
345
+
In [8]: s.ix[-1.0:2]
346
+
Out[2]:
347
+
-1 1
348
+
1 2
349
+
2 3
350
+
dtype: int64
343
351
344
352
- provide a useful exception for indexing with an invalid type for that index when using ``.loc``. For example trying to use ``.loc`` on an index of type ``DatetimeIndex`` or ``PeriodIndex`` or ``TimedeltaIndex``, with an integer (or a float).
0 commit comments