Skip to content

CLN: remove CategoricalIndex._engine #38529

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 1 commit into from
Dec 17, 2020
Merged
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
10 changes: 1 addition & 9 deletions pandas/core/indexes/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pandas._libs import index as libindex
from pandas._libs.lib import no_default
from pandas._typing import ArrayLike, Label
from pandas.util._decorators import Appender, cache_readonly, doc
from pandas.util._decorators import Appender, doc

from pandas.core.dtypes.common import (
ensure_platform_int,
Expand Down Expand Up @@ -381,14 +381,6 @@ def fillna(self, value, downcast=None):
cat = self._data.fillna(value)
return type(self)._simple_new(cat, name=self.name)

@cache_readonly
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm is _engine_type still needed then?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, since codes could be int8, int16, int32, int64

def _engine(self):
# we are going to look things up with the codes themselves.
# To avoid a reference cycle, bind `codes` to a local variable, so
# `self` is not passed into the lambda.
codes = self.codes
return self._engine_type(lambda: codes, len(self))

@doc(Index.unique)
def unique(self, level=None):
if level is not None:
Expand Down