Skip to content

DEPR: Remove NumericIndex.__new__ + related methods #51050

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

Conversation

topper-123
Copy link
Contributor

Removes methods __new__, _ensure_array, _validate_dtype, _ensure_dtype & _assert_safe_casting from NumericIndex. Also adds needed contents to Index and other locations as needed.

Some scaffolding is added to NumericIndex.__new__, but that will be removed in the next PR.

xref #42717.

@topper-123 topper-123 changed the title Remove NumericIndex.__new__ (almost) + various methods Jan 28, 2023
@topper-123 topper-123 changed the title Remove NumericIndex.__new__ (almost) + related methods Jan 29, 2023
@topper-123 topper-123 changed the title DEPR: Remove NumericIndex.__new__ (almost) + related methods Jan 29, 2023
@@ -619,6 +619,7 @@ Other API changes
new DataFrame (shallow copy) instead of the original DataFrame, consistent with other
methods to get a full slice (for example ``df.loc[:]`` or ``df[:]``) (:issue:`49469`)
- Disallow computing ``cumprod`` for :class:`Timedelta` object; previously this returned incorrect values (:issue:`50246`)
- Instantiating an :class:`Index` with an numeric numpy dtype with data containing :class:`NA` and/or :class:`NaT` now raises a ``ValueError``. Previously a ``TypeError`` was raised (:issue:`51050`)
Copy link
Member

Choose a reason for hiding this comment

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

does this match what we raise with Series or DataFrame?

Copy link
Contributor Author

@topper-123 topper-123 Jan 29, 2023

Choose a reason for hiding this comment

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

Yes, so this is also an unification wrt. the errors messages the users get, when they do this kind of mistake.

@mroeschke mroeschke added the Deprecate Functionality to remove in pandas label Jan 30, 2023
@mroeschke mroeschke added this to the 2.0 milestone Jan 30, 2023
@mroeschke mroeschke merged commit 8aad1e7 into pandas-dev:main Jan 30, 2023
@mroeschke
Copy link
Member

Thanks @topper-123

@topper-123 topper-123 deleted the almost_remove_NumericIndex.___new__ branch January 30, 2023 19:28
jbrockmendel pushed a commit to jbrockmendel/pandas that referenced this pull request Jan 30, 2023
* Remove NumericIndex.__new__ (almost) + various methods

* adds GH-number

* fix errors

* fix error II
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
3 participants