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

DEPR: move NumericIndex._engine_type and .inferred_type to Index #50940

Conversation

topper-123
Copy link
Contributor

Moves_engine_type & inferred_type from NumericIndexto Index in preparation to remove NumericIndex and include numpy int/uint/float64 in the base Index.

xref #42717.

@topper-123 topper-123 changed the title DEPR: move NumericIndex._engine_type and NumericIndex.inferred_type t… DEPR: move NumericIndex._engine_type and .inferred_type to Index Jan 23, 2023
@jbrockmendel
Copy link
Member

needs rebase

@mroeschke mroeschke added the Deprecate Functionality to remove in pandas label Jan 23, 2023
@topper-123 topper-123 force-pushed the move_NumericIndex._engine_type_andNumericIndex.inferred_type branch from 0cff92d to 2ccf1f4 Compare January 23, 2023 18:53
@topper-123
Copy link
Contributor Author

Ping.

"u": "integer",
"f": "floating",
"c": "complex",
}[self.dtype.kind]
Copy link
Member

Choose a reason for hiding this comment

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

this doesnt change anything for our nullable dtypes, but in principle could be an API change for 3rd party EAs. worth caring about @mroeschke ?

Copy link
Member

Choose a reason for hiding this comment

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

I think this would be a good API change for ArrowDtype, but not sure what else subsequently relies on the output of Index.inferred_type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change I proposed isn't strictly needed, I just added it as an optimization. I could also remove it here and try do add something similar to lib.infer_dtype instead. It's also a better location for this IMO and at least we can discuss if there's some down side to doing this seperately from the NumericIndex removal process.

Copy link
Member

Choose a reason for hiding this comment

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

to avoid the api change you can do:

if isinstance(self.dtype, np.dtype) and self.dtype.kind in "iufc":
    [...]
return lib.infer_dtype(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I can do it like that.

@topper-123
Copy link
Contributor Author

Updated.

@mroeschke mroeschke added this to the 2.0 milestone Jan 25, 2023
@mroeschke mroeschke merged commit d50c3cc into pandas-dev:main Jan 25, 2023
@mroeschke
Copy link
Member

Thanks @topper-123

@topper-123 topper-123 deleted the move_NumericIndex._engine_type_andNumericIndex.inferred_type branch January 25, 2023 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants