Skip to content

Commit

Permalink
Backport PR #55397 on branch 2.1.x (MAINT: Add warning filter for `np…
Browse files Browse the repository at this point in the history
….long`) (#55402)

Backport PR #55397: MAINT: Add warning filter for `np.long`

Co-authored-by: Mateusz Sokół <8431159+mtsokol@users.noreply.github.com>
  • Loading branch information
meeseeksmachine and mtsokol committed Oct 4, 2023
1 parent 25655e2 commit f07deef
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pandas/compat/numpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
""" support numpy compatibility across versions """
import warnings

import numpy as np

from pandas.util.version import Version
Expand Down Expand Up @@ -26,8 +28,14 @@

if _nlv >= Version("2.0.0.dev0"):
try:
np_long = np.long # type: ignore[attr-defined]
np_ulong = np.ulong # type: ignore[attr-defined]
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
r".*In the future `np\.long` will be defined as.*",
FutureWarning,
)
np_long = np.long # type: ignore[attr-defined]
np_ulong = np.ulong # type: ignore[attr-defined]
except AttributeError:
np_long = np.int_
np_ulong = np.uint
Expand Down

0 comments on commit f07deef

Please sign in to comment.