Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: Drop Categorical.order & sort #16728

Merged
merged 1 commit into from
Jun 19, 2017
Merged
Show file tree
Hide file tree
Changes from all 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.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