Skip to content

COMPAT: Numpy int64 Windows default for Numpy 2.0 #55817

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

Merged
merged 6 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pandas/compat/numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
np_version_gte1p24 = _nlv >= Version("1.24")
np_version_gte1p24p3 = _nlv >= Version("1.24.3")
np_version_gte1p25 = _nlv >= Version("1.25")
np_version_gt2 = _nlv >= Version("2.0.0.dev0")
is_numpy_dev = _nlv.dev is not None
_min_numpy_ver = "1.22.4"

Expand All @@ -27,7 +28,7 @@
np_long: type
np_ulong: type

if _nlv >= Version("2.0.0.dev0"):
if np_version_gt2:
try:
with warnings.catch_warnings():
warnings.filterwarnings(
Expand Down
5 changes: 3 additions & 2 deletions pandas/tests/extension/test_masked.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
IS64,
is_platform_windows,
)
from pandas.compat.numpy import np_version_gt2

import pandas as pd
import pandas._testing as tm
Expand All @@ -42,7 +43,7 @@
)
from pandas.tests.extension import base

is_windows_or_32bit = is_platform_windows() or not IS64
is_windows_or_32bit = (is_platform_windows() and not np_version_gt2) or not IS64

pytestmark = [
pytest.mark.filterwarnings(
Expand Down Expand Up @@ -312,7 +313,7 @@ def check_accumulate(self, ser: pd.Series, op_name: str, skipna: bool):
# overwrite to ensure pd.NA is tested instead of np.nan
# https://github.com/pandas-dev/pandas/issues/30958
length = 64
if not IS64 or is_platform_windows():
if is_windows_or_32bit:
# Item "ExtensionDtype" of "Union[dtype[Any], ExtensionDtype]" has
# no attribute "itemsize"
if not ser.dtype.itemsize == 8: # type: ignore[union-attr]
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/frame/test_reductions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
IS64,
is_platform_windows,
)
from pandas.compat.numpy import np_version_gt2
import pandas.util._test_decorators as td

import pandas as pd
Expand All @@ -32,7 +33,7 @@
nanops,
)

is_windows_or_is32 = is_platform_windows() or not IS64
is_windows_or_is32 = (is_platform_windows() and not np_version_gt2) or not IS64


def assert_stat_op_calc(
Expand Down