Skip to content

Commit

Permalink
MAINT: Drop Categorical.order & sort
Browse files Browse the repository at this point in the history
Deprecated back in 0.18.1

xref pandas-devgh-12882
  • Loading branch information
gfyoung committed Jun 19, 2017
1 parent 125c414 commit ab3264e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 37 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.21.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Removal of prior version deprecations/changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- ``pd.read_excel()`` has dropped the ``has_index_names`` parameter (:issue:`10967`)
- ``Categorical`` has dropped the ``.order()`` and ``.sort()`` methods in favor of ``.sort_values()`` (:issue:`12882`)


.. _whatsnew_0210.performance:
Expand Down
31 changes: 0 additions & 31 deletions pandas/core/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -1447,37 +1447,6 @@ def _values_for_rank(self):
)
return values

def order(self, inplace=False, ascending=True, na_position='last'):
"""
DEPRECATED: use :meth:`Categorical.sort_values`. That function
is entirely equivalent to this one.
See Also
--------
Categorical.sort_values
"""
warn("order is deprecated, use sort_values(...)", FutureWarning,
stacklevel=2)
return self.sort_values(inplace=inplace, ascending=ascending,
na_position=na_position)

def sort(self, inplace=True, ascending=True, na_position='last', **kwargs):
"""
DEPRECATED: use :meth:`Categorical.sort_values`. That function
is just like this one, except that a new Categorical is returned
by default, so make sure to pass in 'inplace=True' to get
inplace sorting.
See Also
--------
Categorical.sort_values
"""
warn("sort is deprecated, use sort_values(...)", FutureWarning,
stacklevel=2)
nv.validate_sort(tuple(), kwargs)
return self.sort_values(inplace=inplace, ascending=ascending,
na_position=na_position)

def ravel(self, order='C'):
""" Return a flattened (numpy) array.
Expand Down
6 changes: 0 additions & 6 deletions pandas/tests/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -3067,12 +3067,6 @@ def test_sort_values(self):
c = Categorical(["a", "b", "b", "a"], ordered=False)
cat = Series(c.copy())

# 'order' was deprecated in gh-10726
# 'sort' was deprecated in gh-12882
for func in ('order', 'sort'):
with tm.assert_produces_warning(FutureWarning):
getattr(c, func)()

# sort in the categories order
expected = Series(
Categorical(["a", "a", "b", "b"],
Expand Down

0 comments on commit ab3264e

Please sign in to comment.