Skip to content

Commit 64da71f

Browse files
committed
simplify implementation
1 parent 7335cb3 commit 64da71f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pandas/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,17 @@ def __dir__():
192192

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

197196
if name in __deprecated_num_index_names:
198-
num_msg = (
197+
warnings.warn(
199198
f"pandas.{name} is deprecated "
200199
"and will be removed from pandas in a future version. "
201-
"Use pandas.NumericIndex with the appropriate dtype instead."
200+
"Use pandas.NumericIndex with the appropriate dtype instead.",
201+
FutureWarning,
202+
stacklevel=2,
202203
)
203-
warnings.warn(num_msg, FutureWarning, stacklevel=2)
204+
from pandas.core.api import Float64Index, Int64Index, UInt64Index
205+
204206
return {
205207
"Float64Index": Float64Index,
206208
"Int64Index": Int64Index,

0 commit comments

Comments
 (0)