Skip to content

Commit d2d17e1

Browse files
authored
DEPS: drop np 1.21 (#54323)
* DEPS: drop np 1.21 * remove more compat * remove all compat * fix typo * ignore type check * revert comments
1 parent 329fe8f commit d2d17e1

File tree

8 files changed

+12
-24
lines changed

8 files changed

+12
-24
lines changed

ci/deps/actions-39-minimum_versions.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies:
2222

2323
# required dependencies
2424
- python-dateutil=2.8.2
25-
- numpy=1.21.6
25+
- numpy=1.22.4
2626
- pytz=2020.1
2727

2828
# optional dependencies

doc/source/getting_started/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ pandas requires the following dependencies.
203203
================================================================ ==========================
204204
Package Minimum supported version
205205
================================================================ ==========================
206-
`NumPy <https://numpy.org>`__ 1.21.6
206+
`NumPy <https://numpy.org>`__ 1.22.4
207207
`python-dateutil <https://dateutil.readthedocs.io/en/stable/>`__ 2.8.2
208208
`pytz <https://pypi.org/project/pytz/>`__ 2020.1
209209
================================================================ ==========================

doc/source/whatsnew/v2.1.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ If installed, we now require:
217217
+-----------------+-----------------+----------+---------+
218218
| Package | Minimum Version | Required | Changed |
219219
+=================+=================+==========+=========+
220-
| numpy | 1.21.6 | X | X |
220+
| numpy | 1.22.4 | X | X |
221221
+-----------------+-----------------+----------+---------+
222222
| mypy (dev) | 1.4.1 | | X |
223223
+-----------------+-----------------+----------+---------+

pandas/compat/numpy/__init__.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@
66
# numpy versioning
77
_np_version = np.__version__
88
_nlv = Version(_np_version)
9-
np_version_under1p22 = _nlv < Version("1.22")
109
np_version_gte1p24 = _nlv >= Version("1.24")
1110
np_version_gte1p24p3 = _nlv >= Version("1.24.3")
1211
np_version_gte1p25 = _nlv >= Version("1.25")
1312
is_numpy_dev = _nlv.dev is not None
14-
_min_numpy_ver = "1.21.6"
15-
16-
np_percentile_argname = "interpolation" if np_version_under1p22 else "method"
13+
_min_numpy_ver = "1.22.4"
1714

1815

1916
if _nlv < Version(_min_numpy_ver):

pandas/core/array_algos/quantile.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import numpy as np
66

7-
from pandas.compat.numpy import np_percentile_argname
8-
97
from pandas.core.dtypes.missing import (
108
isna,
119
na_value_for_dtype,
@@ -150,7 +148,7 @@ def _nanpercentile_1d(
150148
# error: No overload variant of "percentile" matches argument
151149
# types "ndarray[Any, Any]", "ndarray[Any, dtype[floating[_64Bit]]]"
152150
# , "Dict[str, str]" [call-overload]
153-
**{np_percentile_argname: interpolation}, # type: ignore[call-overload]
151+
method=interpolation, # type: ignore[call-overload]
154152
)
155153

156154

@@ -224,5 +222,5 @@ def _nanpercentile(
224222
# error: No overload variant of "percentile" matches argument types
225223
# "ndarray[Any, Any]", "ndarray[Any, dtype[floating[_64Bit]]]",
226224
# "int", "Dict[str, str]" [call-overload]
227-
**{np_percentile_argname: interpolation}, # type: ignore[call-overload]
225+
method=interpolation, # type: ignore[call-overload]
228226
)

pandas/core/frame.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@
5454
from pandas.compat import PYPY
5555
from pandas.compat._constants import REF_COUNT
5656
from pandas.compat._optional import import_optional_dependency
57-
from pandas.compat.numpy import (
58-
function as nv,
59-
np_percentile_argname,
60-
)
57+
from pandas.compat.numpy import function as nv
6158
from pandas.errors import (
6259
ChainedAssignmentError,
6360
InvalidIndexError,
@@ -11704,9 +11701,7 @@ def quantile(
1170411701
dtype = self.dtype
1170511702
return self._constructor([], index=q, columns=data.columns, dtype=dtype)
1170611703

11707-
q_idx = np.quantile( # type: ignore[call-overload]
11708-
np.arange(len(data)), q, **{np_percentile_argname: interpolation}
11709-
)
11704+
q_idx = np.quantile(np.arange(len(data)), q, method=interpolation)
1171011705

1171111706
by = data.columns
1171211707
if len(by) > 1:

pandas/tests/frame/methods/test_quantile.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import numpy as np
22
import pytest
33

4-
from pandas.compat.numpy import np_percentile_argname
5-
64
import pandas as pd
75
from pandas import (
86
DataFrame,
@@ -262,7 +260,7 @@ def test_quantile_interpolation(self):
262260
np.array([[1, 2, 3], [2, 3, 4]]),
263261
0.5,
264262
axis=0,
265-
**{np_percentile_argname: "nearest"},
263+
method="nearest",
266264
)
267265
expected = Series(exp, index=[1, 2, 3], name=0.5, dtype="int64")
268266
tm.assert_series_equal(result, expected)
@@ -276,7 +274,7 @@ def test_quantile_interpolation(self):
276274
np.array([[1.0, 2.0, 3.0], [2.0, 3.0, 4.0]]),
277275
0.5,
278276
axis=0,
279-
**{np_percentile_argname: "nearest"},
277+
method="nearest",
280278
)
281279
expected = Series(exp, index=[1, 2, 3], name=0.5, dtype="float64")
282280
tm.assert_series_equal(result, expected)

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ requires = [
1010
# we don't want to force users to compile with 1.25 though
1111
# (Ideally, in the future, though, oldest-supported-numpy can be dropped when our min numpy is 1.25.x)
1212
"oldest-supported-numpy>=2022.8.16; python_version<'3.12'",
13-
"numpy>=1.21.6; python_version>='3.12'",
13+
"numpy>=1.22.4; python_version>='3.12'",
1414
"versioneer[toml]"
1515
]
1616

@@ -29,7 +29,7 @@ authors = [
2929
license = {file = 'LICENSE'}
3030
requires-python = '>=3.9'
3131
dependencies = [
32-
"numpy>=1.21.6; python_version<'3.11'",
32+
"numpy>=1.22.4; python_version<'3.11'",
3333
"numpy>=1.23.2; python_version>='3.11'",
3434
"python-dateutil>=2.8.2",
3535
"pytz>=2020.1",

0 commit comments

Comments
 (0)