Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.25.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ Removal of prior version deprecations/changes
- Removed the previously deprecated ``ordered`` and ``categories`` keyword arguments in ``astype`` (:issue:`17742`)
- Removed the previously deprecated ``cdate_range`` (:issue:`17691`)
- Removed the previously deprecated ``True`` option for the ``dropna`` keyword argument in :func:`SeriesGroupBy.nth` (:issue:`17493`)
- Removed the previously deprecated ``covert`` keyword argument in :meth:`Series.take` (:issue:`17352`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Removed the previously deprecated ``covert`` keyword argument in :meth:`Series.take` (:issue:`17352`)
- Removed the previously deprecated ``convert`` keyword argument in :meth:`Series.take` (:issue:`17352`)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I don't recall it being just limited to Series.take...


.. _whatsnew_0250.performance:

Expand Down
16 changes: 1 addition & 15 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3365,7 +3365,7 @@ def _take(self, indices, axis=0, is_copy=True):

return result

def take(self, indices, axis=0, convert=None, is_copy=True, **kwargs):
def take(self, indices, axis=0, is_copy=True, **kwargs):
"""
Return the elements in the given *positional* indices along an axis.

Expand All @@ -3380,15 +3380,6 @@ def take(self, indices, axis=0, convert=None, is_copy=True, **kwargs):
axis : {0 or 'index', 1 or 'columns', None}, default 0
The axis on which to select elements. ``0`` means that we are
selecting rows, ``1`` means that we are selecting columns.
convert : bool, default True
Whether to convert negative indices into positive ones.
For example, ``-1`` would map to the ``len(axis) - 1``.
The conversions are similar to the behavior of indexing a
regular Python list.

.. deprecated:: 0.21.0
In the future, negative indices will always be converted.

is_copy : bool, default True
Whether to return a copy of the original object or not.
**kwargs
Expand Down Expand Up @@ -3449,11 +3440,6 @@ class max_speed
1 monkey mammal NaN
3 lion mammal 80.5
"""
if convert is not None:
msg = ("The 'convert' parameter is deprecated "
"and will be removed in a future version.")
warnings.warn(msg, FutureWarning, stacklevel=2)

nv.validate_take(tuple(), kwargs)
return self._take(indices, axis=axis, is_copy=is_copy)

Expand Down
3 changes: 0 additions & 3 deletions pandas/tests/series/indexing/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,6 @@ def test_take():
with pytest.raises(IndexError, match=msg.format(5)):
s.take([2, 5])

with tm.assert_produces_warning(FutureWarning):
s.take([-1, 3, 4], convert=False)


def test_take_categorical():
# https://github.com/pandas-dev/pandas/issues/20664
Expand Down
9 changes: 0 additions & 9 deletions pandas/tests/sparse/series/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,15 +542,6 @@ def _compare(idx):
exp = pd.Series(np.repeat(nan, 5))
tm.assert_series_equal(sp.take([0, 1, 2, 3, 4]), exp.to_sparse())

# multiple FutureWarnings, can't check stacklevel
with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
sp.take([1, 5], convert=True)

with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
sp.take([1, 5], convert=False)

def test_numpy_take(self):
sp = SparseSeries([1.0, 2.0, 3.0])
indices = [1, 2]
Expand Down