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/v1.5.0.rst
+44
Original file line number
Diff line number
Diff line change
@@ -94,6 +94,50 @@ Other API changes
94
94
95
95
Deprecations
96
96
~~~~~~~~~~~~
97
+
98
+
.. _whatsnew_150.deprecations.int_slicing_series:
99
+
100
+
In a future version, integer slicing on a :class:`Series` with a :class:`Int64Index` or :class:`RangeIndex` will be treated as *label-based*, not positional. This will make the behavior consistent with other :meth:`Series.__getitem__` and :meth:`Series.__setitem__` behaviors (:issue:`45162`).
In the old behavior, ``ser[2:4]`` treats the slice as positional:
109
+
110
+
*Old behavior*:
111
+
112
+
.. code-block:: ipython
113
+
114
+
In [3]: ser[2:4]
115
+
Out[3]:
116
+
5 3
117
+
7 4
118
+
dtype: int64
119
+
120
+
In a future version, this will be treated as label-based:
121
+
122
+
*Future behavior*:
123
+
124
+
.. code-block:: ipython
125
+
126
+
In [4]: ser.loc[2:4]
127
+
Out[4]:
128
+
2 1
129
+
3 2
130
+
dtype: int64
131
+
132
+
To retain the old behavior, use ``series.iloc[i:j]``. To get the future behavior,
133
+
use ``series.loc[i:j]``.
134
+
135
+
Slicing on a :class:`DataFrame` will not be affected.
136
+
137
+
.. _whatsnew_150.deprecations.other:
138
+
139
+
Other Deprecations
140
+
^^^^^^^^^^^^^^^^^^
97
141
- Deprecated the keyword ``line_terminator`` in :meth:`DataFrame.to_csv` and :meth:`Series.to_csv`, use ``lineterminator`` instead; this is for consistency with :func:`read_csv` and the standard library 'csv' module (:issue:`9568`)
98
142
- Deprecated :meth:`DataFrame.iteritems`, :meth:`Series.iteritems`, :meth:`HDFStore.iteritems` in favor of :meth:`DataFrame.items`, :meth:`Series.items`, :meth:`HDFStore.items` (:issue:`45321`)
0 commit comments