Skip to content

DEPS: Bump NumPy and tzdata #61806

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 5 commits into from
Jul 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions ci/deps/actions-310-minimum_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies:

# required dependencies
- python-dateutil=2.8.2
- numpy=1.23.5
- numpy=1.26.0

# optional dependencies
- beautifulsoup4=4.12.3
Expand Down Expand Up @@ -62,4 +62,4 @@ dependencies:
- pip:
- adbc-driver-postgresql==0.10.0
- adbc-driver-sqlite==0.8.0
- tzdata==2022.7
- tzdata==2023.3
2 changes: 1 addition & 1 deletion ci/deps/actions-310.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ dependencies:
- pip:
- adbc-driver-postgresql>=0.10.0
- adbc-driver-sqlite>=0.8.0
- tzdata>=2022.7
- tzdata>=2023.3
2 changes: 1 addition & 1 deletion ci/deps/actions-311-downstream_compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ dependencies:
- pip:
- adbc-driver-postgresql>=0.10.0
- adbc-driver-sqlite>=0.8.0
- tzdata>=2022.7
- tzdata>=2023.3
2 changes: 1 addition & 1 deletion ci/deps/actions-311-numpydev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ dependencies:
- "--extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"
- "--pre"
- "numpy"
- "tzdata>=2022.7"
- "tzdata>=2023.3"
2 changes: 1 addition & 1 deletion ci/deps/actions-311-pyarrownightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies:
- pip

- pip:
- "tzdata>=2022.7"
- "tzdata>=2023.3"
- "--extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"
- "--prefer-binary"
- "--pre"
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/actions-312.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ dependencies:
- pip:
- adbc-driver-postgresql>=0.10.0
- adbc-driver-sqlite>=0.8.0
- tzdata>=2022.7
- tzdata>=2023.3
2 changes: 1 addition & 1 deletion ci/deps/actions-313-freethreading.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ dependencies:
- pip:
# No free-threaded coveragepy (with the C-extension) on conda-forge yet
- pytest-cov
- "tzdata>=2022.7"
- tzdata>=2023.3
- "--extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"
2 changes: 1 addition & 1 deletion ci/deps/actions-313.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ dependencies:
- pip:
- adbc-driver-postgresql>=0.10.0
- adbc-driver-sqlite>=0.8.0
- tzdata>=2022.7
- tzdata>=2023.3
2 changes: 1 addition & 1 deletion ci/deps/actions-pypy-39.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ dependencies:
- numpy
- python-dateutil
- pip:
- tzdata>=2022.7
- tzdata>=2023.3
2 changes: 1 addition & 1 deletion ci/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ requirements:
- numpy >=1.21.6 # [py<311]
- numpy >=1.23.2 # [py>=311]
- python-dateutil >=2.8.2
- python-tzdata >=2022.7
- python-tzdata >=2023.3

test:
imports:
Expand Down
4 changes: 2 additions & 2 deletions doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ pandas requires the following dependencies.
================================================================ ==========================
Package Minimum supported version
================================================================ ==========================
`NumPy <https://numpy.org>`__ 1.23.5
`NumPy <https://numpy.org>`__ 1.26.0
`python-dateutil <https://dateutil.readthedocs.io/en/stable/>`__ 2.8.2
`tzdata <https://pypi.org/project/tzdata/>`__ 2022.7
`tzdata <https://pypi.org/project/tzdata/>`__ 2023.3
================================================================ ==========================

.. _install.optional_dependencies:
Expand Down
16 changes: 9 additions & 7 deletions doc/source/whatsnew/v3.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,15 @@ pandas 3.0.0 supports Python 3.10 and higher.
Increased minimum versions for dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Some minimum supported versions of dependencies were updated.
If installed, we now require:

+-----------------+-----------------+----------+---------+
| Package | Minimum Version | Required | Changed |
+=================+=================+==========+=========+
| numpy | 1.23.5 | X | X |
+-----------------+-----------------+----------+---------+
The following required dependencies were updated:

+-----------------+----------------------+
| Package | New Minimum Version |
+=================+======================+
| numpy | 1.26.0 |
+-----------------+----------------------+
| tzdata | 2023.3 |
+-----------------+----------------------+

For `optional libraries <https://pandas.pydata.org/docs/getting_started/install.html>`_ the general recommendation is to use the latest version.
The following table lists the lowest version per library that is currently being tested throughout the development of pandas.
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ dependencies:
- adbc-driver-postgresql>=0.10.0
- adbc-driver-sqlite>=0.8.0
- typing_extensions; python_version<"3.11"
- tzdata>=2022.7
- tzdata>=2023.3
1 change: 0 additions & 1 deletion pandas/compat/_optional.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"xlrd": "2.0.1",
"xlsxwriter": "3.2.0",
"zstandard": "0.22.0",
"tzdata": "2022.7",
"qtpy": "2.3.0",
"pyqt5": "5.15.9",
}
Expand Down
11 changes: 3 additions & 8 deletions pandas/compat/numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,15 @@
# numpy versioning
_np_version = np.__version__
_nlv = Version(_np_version)
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")
is_numpy_dev = _nlv.dev is not None
_min_numpy_ver = "1.23.5"
_min_numpy_ver = "1.26.0"


if _nlv < Version(_min_numpy_ver):
raise ImportError(
f"this version of pandas is incompatible with numpy < {_min_numpy_ver}\n"
f"your numpy version is {_np_version}.\n"
f"Please upgrade numpy to >= {_min_numpy_ver} to use this pandas version"
f"Please upgrade numpy to >= {_min_numpy_ver} to use this pandas version.\n"
f"Your numpy version is {_np_version}."
)


Expand Down Expand Up @@ -49,5 +45,4 @@
__all__ = [
"_np_version",
"is_numpy_dev",
"np",
]
9 changes: 1 addition & 8 deletions pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@
cast,
overload,
)
import warnings

import numpy as np

from pandas._libs import lib
from pandas.compat.numpy import np_version_gte1p24

from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
from pandas.core.dtypes.common import (
Expand Down Expand Up @@ -243,12 +241,7 @@ def asarray_tuplesafe(values: Iterable, dtype: NpDtype | None = None) -> ArrayLi
return construct_1d_object_array_from_listlike(values)

try:
with warnings.catch_warnings():
# Can remove warning filter once NumPy 1.24 is min version
if not np_version_gte1p24:
# np.VisibleDeprecationWarning only in np.exceptions in 2.0
warnings.simplefilter("ignore", np.VisibleDeprecationWarning) # type: ignore[attr-defined]
result = np.asarray(values, dtype=dtype)
result = np.asarray(values, dtype=dtype)
except ValueError:
# Using try/except since it's more performant than checking is_list_like
# over each element
Expand Down
10 changes: 3 additions & 7 deletions pandas/tests/apply/test_frame_apply_relabeling.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import numpy as np
import pytest

from pandas.compat.numpy import np_version_gte1p25

import pandas as pd
import pandas._testing as tm
Expand Down Expand Up @@ -45,7 +42,6 @@ def test_agg_relabel_multi_columns_multi_methods():
tm.assert_frame_equal(result, expected)


@pytest.mark.xfail(np_version_gte1p25, reason="name of min now equals name of np.min")
def test_agg_relabel_partial_functions():
# GH 26513, test on partial, functools or more complex cases
df = pd.DataFrame({"A": [1, 2, 1, 2], "B": [1, 2, 3, 4], "C": [3, 4, 5, 6]})
Expand All @@ -57,16 +53,16 @@ def test_agg_relabel_partial_functions():

result = df.agg(
foo=("A", min),
bar=("A", np.min),
bar=("B", np.min),
cat=("B", max),
dat=("C", "min"),
f=("B", np.sum),
kk=("B", lambda x: min(x)),
)
expected = pd.DataFrame(
{
"A": [1.0, 1.0, np.nan, np.nan, np.nan, np.nan],
"B": [np.nan, np.nan, 4.0, np.nan, 10.0, 1.0],
"A": [1.0, np.nan, np.nan, np.nan, np.nan, np.nan],
"B": [np.nan, 1.0, 4.0, np.nan, 10.0, 1.0],
"C": [np.nan, np.nan, np.nan, 3.0, np.nan, np.nan],
},
index=pd.Index(["foo", "bar", "cat", "dat", "f", "kk"]),
Expand Down
3 changes: 1 addition & 2 deletions pandas/tests/extension/test_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
iNaT,
)
from pandas.compat import is_platform_windows
from pandas.compat.numpy import np_version_gte1p24

from pandas.core.dtypes.dtypes import PeriodDtype

Expand Down Expand Up @@ -104,7 +103,7 @@ def check_reduce(self, ser: pd.Series, op_name: str, skipna: bool):

@pytest.mark.parametrize("periods", [1, -2])
def test_diff(self, data, periods):
if is_platform_windows() and np_version_gte1p24:
if is_platform_windows():
with tm.assert_produces_warning(RuntimeWarning, check_stacklevel=False):
super().test_diff(data, periods)
else:
Expand Down
4 changes: 1 addition & 3 deletions pandas/tests/frame/methods/test_compare.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import numpy as np
import pytest

from pandas.compat.numpy import np_version_gte1p25

import pandas as pd
import pandas._testing as tm

Expand Down Expand Up @@ -270,7 +268,7 @@ def test_compare_ea_and_np_dtype(val1, val2):
# GH#18463 TODO: is this really the desired behavior?
expected.loc[1, ("a", "self")] = np.nan

if val1 is pd.NA and np_version_gte1p25:
if val1 is pd.NA:
# can't compare with numpy array if it contains pd.NA
with pytest.raises(TypeError, match="boolean value of NA is ambiguous"):
result = df1.compare(df2, keep_shape=True)
Expand Down
13 changes: 4 additions & 9 deletions pandas/tests/frame/test_unary.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import numpy as np
import pytest

from pandas.compat.numpy import np_version_gte1p25

import pandas as pd
import pandas._testing as tm

Expand Down Expand Up @@ -123,13 +121,10 @@ def test_pos_object(self, df_data):
def test_pos_object_raises(self):
# GH#21380
df = pd.DataFrame({"a": ["a", "b"]})
if np_version_gte1p25:
with pytest.raises(
TypeError, match=r"^bad operand type for unary \+: \'str\'$"
):
tm.assert_frame_equal(+df, df)
else:
tm.assert_series_equal(+df["a"], df["a"])
with pytest.raises(
TypeError, match=r"^bad operand type for unary \+: \'str\'$"
):
tm.assert_frame_equal(+df, df)

def test_pos_raises(self):
df = pd.DataFrame({"a": pd.to_datetime(["2017-01-22", "1970-01-01"])})
Expand Down
13 changes: 5 additions & 8 deletions pandas/tests/indexes/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import pytest

from pandas.compat import IS64
from pandas.compat.numpy import np_version_gte1p25

from pandas.core.dtypes.common import (
is_integer_dtype,
Expand Down Expand Up @@ -381,13 +380,11 @@ def test_astype_preserves_name(self, index, dtype):
else:
index.name = "idx"

warn = None
if index.dtype.kind == "c" and dtype in ["float64", "int64", "uint64"]:
# imaginary components discarded
if np_version_gte1p25:
warn = np.exceptions.ComplexWarning
else:
warn = np.ComplexWarning
warn = (
np.exceptions.ComplexWarning
if index.dtype.kind == "c" and dtype in ["float64", "int64", "uint64"]
else None
)

is_pyarrow_str = str(index.dtype) == "string[pyarrow]" and dtype == "category"
try:
Expand Down
4 changes: 1 addition & 3 deletions pandas/tests/io/parser/test_c_parser_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import pytest

from pandas.compat import WASM
from pandas.compat.numpy import np_version_gte1p24
from pandas.errors import (
ParserError,
ParserWarning,
Expand Down Expand Up @@ -90,10 +89,9 @@ def test_dtype_and_names_error(c_parser_only):
3.0 3
"""
# fallback casting, but not castable
warning = RuntimeWarning if np_version_gte1p24 else None
if not WASM: # no fp exception support in wasm
with pytest.raises(ValueError, match="cannot safely convert"):
with tm.assert_produces_warning(warning, check_stacklevel=False):
with tm.assert_produces_warning(RuntimeWarning, check_stacklevel=False):
parser.read_csv(
StringIO(data),
sep=r"\s+",
Expand Down
3 changes: 3 additions & 0 deletions pandas/tests/io/pytables/test_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ def test_complex_mixed_fixed(tmp_path, setup_path):
tm.assert_frame_equal(df, reread)


@pytest.mark.filterwarnings(
"ignore:`alltrue` is deprecated as of NumPy 1.25.0:DeprecationWarning"
)
def test_complex_mixed_table(tmp_path, setup_path):
complex64 = np.array(
[1.0 + 1.0j, 1.0 + 1.0j, 1.0 + 1.0j, 1.0 + 1.0j], dtype=np.complex64
Expand Down
6 changes: 6 additions & 0 deletions pandas/tests/io/pytables/test_timezones.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ def _compare_with_tz(a, b):
gettz_pytz = lambda x: x


@pytest.mark.filterwarnings(
"ignore:`alltrue` is deprecated as of NumPy 1.25.0:DeprecationWarning"
)
@pytest.mark.parametrize("gettz", [gettz_dateutil, gettz_pytz])
def test_append_with_timezones(setup_path, gettz):
# as columns
Expand Down Expand Up @@ -332,6 +335,9 @@ def test_dst_transitions(setup_path):
tm.assert_frame_equal(result, df)


@pytest.mark.filterwarnings(
"ignore:`alltrue` is deprecated as of NumPy 1.25.0:DeprecationWarning"
)
def test_read_with_where_tz_aware_index(tmp_path, setup_path):
# GH 11926
periods = 10
Expand Down
5 changes: 2 additions & 3 deletions pandas/tests/plotting/frame/test_frame_subplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import pytest

from pandas.compat import is_platform_linux
from pandas.compat.numpy import np_version_gte1p24

import pandas as pd
from pandas import (
Expand Down Expand Up @@ -423,7 +422,7 @@ def test_subplots_dup_columns_secondary_y_no_subplot(self):
assert len(ax.right_ax.lines) == 5

@pytest.mark.xfail(
np_version_gte1p24 and is_platform_linux(),
is_platform_linux(),
reason="Weird rounding problems",
strict=False,
)
Expand All @@ -438,7 +437,7 @@ def test_bar_log_no_subplots(self):
tm.assert_numpy_array_equal(ax.yaxis.get_ticklocs(), expected)

@pytest.mark.xfail(
np_version_gte1p24 and is_platform_linux(),
is_platform_linux(),
reason="Weird rounding problems",
strict=False,
)
Expand Down
Loading
Loading