Skip to content

API/DEPR: Index.view _typ check, return type #55709

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

Closed
jbrockmendel opened this issue Oct 26, 2023 · 1 comment · Fixed by #56421
Closed

API/DEPR: Index.view _typ check, return type #55709

jbrockmendel opened this issue Oct 26, 2023 · 1 comment · Fixed by #56421
Labels
API Design Deprecate Functionality to remove in pandas

Comments

@jbrockmendel
Copy link
Member

jbrockmendel commented Oct 26, 2023

Index.view has a cls argument (instead of dtype, which I would expect) and starts with:

        # we need to see if we are subclassing an
        # index type here
        if cls is not None and not hasattr(cls, "_typ"):

The "_typ" check must have been intended to catch types defined in pd.core.dtypes.generic, but it isn't clear to me why we do that.

Let's just have view take a dtype keyword like Series.view.

update: also it sometimes returns an Index and other times an ArrayLike. let's choose just one.

@jbrockmendel jbrockmendel added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 26, 2023
@jbrockmendel jbrockmendel changed the title API: Index.view _typ check API/DEPR: Index.view _typ check Oct 26, 2023
@jbrockmendel jbrockmendel changed the title API/DEPR: Index.view _typ check API/DEPR: Index.view _typ check, return type Oct 26, 2023
@jorisvandenbossche
Copy link
Member

Or deprecate it, like we want to do for Series (#20251), and only keep it on the array level?

@jbrockmendel jbrockmendel added the Deprecate Functionality to remove in pandas label Nov 1, 2023
@lithomas1 lithomas1 added API Design and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Deprecate Functionality to remove in pandas
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants