Skip to content

Commit f07deef

Browse files
Backport PR #55397 on branch 2.1.x (MAINT: Add warning filter for np.long) (#55402)
Backport PR #55397: MAINT: Add warning filter for `np.long` Co-authored-by: Mateusz Sokół <[email protected]>
1 parent 25655e2 commit f07deef

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pandas/compat/numpy/__init__.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
""" support numpy compatibility across versions """
2+
import warnings
3+
24
import numpy as np
35

46
from pandas.util.version import Version
@@ -26,8 +28,14 @@
2628

2729
if _nlv >= Version("2.0.0.dev0"):
2830
try:
29-
np_long = np.long # type: ignore[attr-defined]
30-
np_ulong = np.ulong # type: ignore[attr-defined]
31+
with warnings.catch_warnings():
32+
warnings.filterwarnings(
33+
"ignore",
34+
r".*In the future `np\.long` will be defined as.*",
35+
FutureWarning,
36+
)
37+
np_long = np.long # type: ignore[attr-defined]
38+
np_ulong = np.ulong # type: ignore[attr-defined]
3139
except AttributeError:
3240
np_long = np.int_
3341
np_ulong = np.uint

0 commit comments

Comments
 (0)