Skip to content

TYP: check_untyped_defs core.arrays.categorical #32097

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

Merged
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
11 changes: 4 additions & 7 deletions pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,7 @@ def __init__(
values = _convert_to_list_like(values)

# By convention, empty lists result in object dtype:
if len(values) == 0:
sanitize_dtype = "object"
else:
sanitize_dtype = None
sanitize_dtype = "object" if len(values) == 0 else None
null_mask = isna(values)
if null_mask.any():
values = [values[idx] for idx in np.where(~null_mask)[0]]
Expand Down Expand Up @@ -1496,7 +1493,7 @@ def check_for_ordered(self, op):
def _values_for_argsort(self):
return self._codes.copy()

def argsort(self, ascending=True, kind="quicksort", *args, **kwargs):
def argsort(self, ascending=True, kind="quicksort", **kwargs):
"""
Return the indices that would sort the Categorical.

Expand All @@ -1511,7 +1508,7 @@ def argsort(self, ascending=True, kind="quicksort", *args, **kwargs):
or descending sort.
kind : {'quicksort', 'mergesort', 'heapsort'}, optional
Sorting algorithm.
*args, **kwargs:
**kwargs:
passed through to :func:`numpy.argsort`.

Returns
Expand Down Expand Up @@ -1547,7 +1544,7 @@ def argsort(self, ascending=True, kind="quicksort", *args, **kwargs):
>>> cat.argsort()
array([2, 0, 1])
"""
return super().argsort(ascending=ascending, kind=kind, *args, **kwargs)
return super().argsort(ascending=ascending, kind=kind, **kwargs)

def sort_values(self, inplace=False, ascending=True, na_position="last"):
"""
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ check_untyped_defs=False
[mypy-pandas._version]
check_untyped_defs=False

[mypy-pandas.core.arrays.categorical]
check_untyped_defs=False

[mypy-pandas.core.arrays.interval]
check_untyped_defs=False

Expand Down