Skip to content

Commit 7335cb3

Browse files
committed
cleanup
1 parent 33bb44f commit 7335cb3

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

pandas/__init__.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -192,31 +192,20 @@ def __dir__():
192192

193193
def __getattr__(name):
194194
import warnings
195+
from pandas.core.api import Float64Index, Int64Index, UInt64Index
195196

196197
if name in __deprecated_num_index_names:
197198
num_msg = (
198199
f"pandas.{name} is deprecated "
199200
"and will be removed from pandas in a future version. "
200201
"Use pandas.NumericIndex with the appropriate dtype instead."
201202
)
202-
if name == "Int64Index":
203-
from pandas.core.api import Int64Index
204-
205-
warnings.warn(num_msg, FutureWarning, stacklevel=2)
206-
return Int64Index
207-
elif name == "UInt64Index":
208-
from pandas.core.api import UInt64Index
209-
210-
warnings.warn(num_msg, FutureWarning, stacklevel=2)
211-
return UInt64Index
212-
elif name == "Float64Index":
213-
from pandas.core.api import Float64Index
214-
215-
warnings.warn(num_msg, FutureWarning, stacklevel=2)
216-
return Float64Index
217-
else:
218-
raise NameError(name)
219-
203+
warnings.warn(num_msg, FutureWarning, stacklevel=2)
204+
return {
205+
"Float64Index": Float64Index,
206+
"Int64Index": Int64Index,
207+
"UInt64Index": UInt64Index,
208+
}[name]
220209
elif name == "datetime":
221210
warnings.warn(
222211
"The pandas.datetime class is deprecated "

0 commit comments

Comments
 (0)