-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DEPR: Int64Index, UInt64Index & Float64Index #43028
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
Changes from all commits
ac7c6c8
79e979c
1f528ea
ba9b33a
36c7f5a
ad2ea3c
53346ba
6eab0ff
84007a3
e0644ea
502386d
8ee54a1
96fa814
4cb859c
e84b363
7ca2ef7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,10 +70,7 @@ | |
# indexes | ||
Index, | ||
CategoricalIndex, | ||
Int64Index, | ||
UInt64Index, | ||
RangeIndex, | ||
Float64Index, | ||
NumericIndex, | ||
MultiIndex, | ||
IntervalIndex, | ||
|
@@ -186,10 +183,35 @@ | |
|
||
|
||
# GH 27101 | ||
__deprecated_num_index_names = ["Float64Index", "Int64Index", "UInt64Index"] | ||
|
||
|
||
def __dir__(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is so Int64Index etc. show up in dir calls. Int64Index etc. have been quite prominent parts of the public API, so I think it's better that they still show up for the duration of Pandas 1.x. This should be removed in Pandas 2.0. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok can you add a comment to this effect |
||
# GH43028 | ||
# Int64Index etc. are deprecated, but we still want them to be available in the dir. | ||
# Remove in Pandas 2.0, when we remove Int64Index etc. from the code base. | ||
return list(globals().keys()) + __deprecated_num_index_names | ||
|
||
|
||
def __getattr__(name): | ||
import warnings | ||
|
||
if name == "datetime": | ||
if name in __deprecated_num_index_names: | ||
warnings.warn( | ||
f"pandas.{name} is deprecated " | ||
"and will be removed from pandas in a future version. " | ||
"Use pandas.NumericIndex with the appropriate dtype instead.", | ||
FutureWarning, | ||
stacklevel=2, | ||
) | ||
from pandas.core.api import Float64Index, Int64Index, UInt64Index | ||
|
||
return { | ||
"Float64Index": Float64Index, | ||
"Int64Index": Int64Index, | ||
"UInt64Index": UInt64Index, | ||
}[name] | ||
elif name == "datetime": | ||
warnings.warn( | ||
"The pandas.datetime class is deprecated " | ||
"and will be removed from pandas in a future version. " | ||
|
Uh oh!
There was an error while loading. Please reload this page.