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

ABCIndex does not recognize Int64Index #17184

Closed
jbrockmendel opened this issue Aug 6, 2017 · 2 comments
Closed

ABCIndex does not recognize Int64Index #17184

jbrockmendel opened this issue Aug 6, 2017 · 2 comments

Comments

@jbrockmendel
Copy link
Member

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?

@jreback
Copy link
Contributor

jreback commented Aug 6, 2017

this is as expected

@jreback jreback closed this as completed Aug 6, 2017
@jbrockmendel
Copy link
Member Author

Should the comment in _make_str_accessor refer to ABCIndexClass?

@jorisvandenbossche jorisvandenbossche added this to the No action milestone Aug 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants