Is this intentional? Is the idea that isinstance(foo, Index)
can be replaced by isinstance(foo, ABCIndexClass)
and not isinstance(foo, ABCIndex)
? Now that I look at it this seems obvious, but still unexpected.
import pandas as pd
idx = pd.Int64Index([1, 2, 1, 1, 1], dtype='int64')
>>> isinstance(idx, pd.core.dtypes.generic.ABCIndex)
False
Checking isinstance(by, ABCIndex)
instead of isinstance(by, Index)
caused a test failure in #17174.
Possibly related is a comment in pd.core.strings.StringAccessorMixin._make_str_accessor
:
elif isinstance(self, Index):
# can't use ABCIndex to exclude non-str
I count 6 usages of ABCIndex
across the package. Are we sure no one else has made the same mistake I did of using this where ABCIndexClass
should have been used?
Comment From: jreback
this is as expected
Comment From: jbrockmendel
Should the comment in _make_str_accessor
refer to ABCIndexClass
?