Skip to content

Commit 6a0b552

Browse files
committed
DEPS: drop numpy 1.16 pandas-dev#40814
1 parent 822db7a commit 6a0b552

21 files changed

+30
-108
lines changed

ci/azure/windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
vmImage: ${{ parameters.vmImage }}
99
strategy:
1010
matrix:
11-
py37_np16:
11+
py37_np17:
1212
ENV_FILE: ci/deps/azure-windows-37.yaml
1313
CONDA_PY: "37"
1414
PATTERN: "not slow and not network"

ci/deps/actions-37-minimum_versions.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
- jinja2=2.10
1919
- numba=0.46.0
2020
- numexpr=2.6.8
21-
- numpy=1.16.5
21+
- numpy=1.17.3
2222
- openpyxl=3.0.0
2323
- pytables=3.5.1
2424
- python-dateutil=2.7.3

ci/deps/azure-macos-37.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies:
1919
- matplotlib=2.2.3
2020
- nomkl
2121
- numexpr
22-
- numpy=1.16.5
22+
- numpy=1.17.3
2323
- openpyxl
2424
- pyarrow=0.15.1
2525
- pytables

ci/deps/azure-windows-37.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies:
2424
- moto>=1.3.14
2525
- flask
2626
- numexpr
27-
- numpy=1.16.*
27+
- numpy=1.17.*
2828
- openpyxl
2929
- pyarrow=0.15
3030
- pytables

doc/source/getting_started/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ Dependencies
222222
Package Minimum supported version
223223
================================================================ ==========================
224224
`setuptools <https://setuptools.readthedocs.io/en/latest/>`__ 38.6.0
225-
`NumPy <https://numpy.org>`__ 1.16.5
225+
`NumPy <https://numpy.org>`__ 1.17.3
226226
`python-dateutil <https://dateutil.readthedocs.io/en/stable/>`__ 2.7.3
227227
`pytz <https://pypi.org/project/pytz/>`__ 2017.3
228228
================================================================ ==========================

doc/source/whatsnew/v1.3.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ If installed, we now require:
444444
+-----------------+-----------------+----------+---------+
445445
| Package | Minimum Version | Required | Changed |
446446
+=================+=================+==========+=========+
447-
| numpy | 1.16.5 | X | |
447+
| numpy | 1.17.3 | X | X |
448448
+-----------------+-----------------+----------+---------+
449449
| pytz | 2017.3 | X | |
450450
+-----------------+-----------------+----------+---------+

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ channels:
33
- conda-forge
44
dependencies:
55
# required
6-
- numpy>=1.16.5
6+
- numpy>=1.17.3
77
- python=3
88
- python-dateutil>=2.7.3
99
- pytz

pandas/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
# numpy compat
2222
from pandas.compat import (
23-
np_version_under1p17 as _np_version_under1p17,
2423
np_version_under1p18 as _np_version_under1p18,
2524
is_numpy_dev as _is_numpy_dev,
2625
)

pandas/compat/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
is_numpy_dev,
1717
np_array_datetime64_compat,
1818
np_datetime64_compat,
19-
np_version_under1p17,
2019
np_version_under1p18,
2120
np_version_under1p19,
2221
np_version_under1p20,
@@ -133,7 +132,6 @@ def get_lzma_file(lzma):
133132
"is_numpy_dev",
134133
"np_array_datetime64_compat",
135134
"np_datetime64_compat",
136-
"np_version_under1p17",
137135
"np_version_under1p18",
138136
"np_version_under1p19",
139137
"np_version_under1p20",

pandas/compat/numpy/__init__.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
# numpy versioning
99
_np_version = np.__version__
1010
_nlv = LooseVersion(_np_version)
11-
np_version_under1p17 = _nlv < LooseVersion("1.17")
1211
np_version_under1p18 = _nlv < LooseVersion("1.18")
1312
np_version_under1p19 = _nlv < LooseVersion("1.19")
1413
np_version_under1p20 = _nlv < LooseVersion("1.20")
1514
is_numpy_dev = ".dev" in str(_nlv)
16-
_min_numpy_ver = "1.16.5"
15+
_min_numpy_ver = "1.17.3"
1716

1817

1918
if _nlv < _min_numpy_ver:
@@ -65,6 +64,5 @@ def np_array_datetime64_compat(arr, dtype="M8[ns]"):
6564
__all__ = [
6665
"np",
6766
"_np_version",
68-
"np_version_under1p17",
6967
"is_numpy_dev",
7068
]

pandas/core/array_algos/masked_reductions.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import numpy as np
99

1010
from pandas._libs import missing as libmissing
11-
from pandas.compat import np_version_under1p17
1211

1312
from pandas.core.nanops import check_below_min_count
1413

@@ -46,11 +45,7 @@ def _sumprod(
4645
else:
4746
if check_below_min_count(values.shape, mask, min_count):
4847
return libmissing.NA
49-
50-
if np_version_under1p17:
51-
return func(values[~mask])
52-
else:
53-
return func(values, where=~mask)
48+
return func(values, where=~mask)
5449

5550

5651
def sum(

pandas/tests/api/test_api.py

-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ class TestPDApi(Base):
192192
"_hashtable",
193193
"_lib",
194194
"_libs",
195-
"_np_version_under1p17",
196195
"_np_version_under1p18",
197196
"_is_numpy_dev",
198197
"_testing",

pandas/tests/computation/test_eval.py

-20
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
import numpy as np
1313
import pytest
1414

15-
from pandas.compat import (
16-
is_platform_windows,
17-
np_version_under1p17,
18-
)
1915
from pandas.errors import PerformanceWarning
2016
import pandas.util._test_decorators as td
2117

@@ -220,22 +216,6 @@ def test_simple_cmp_ops(self, cmp_op):
220216

221217
@pytest.mark.parametrize("op", _good_arith_ops)
222218
def test_binary_arith_ops(self, op, lhs, rhs, request):
223-
224-
if (
225-
op == "/"
226-
and isinstance(lhs, DataFrame)
227-
and isinstance(rhs, DataFrame)
228-
and not lhs.isna().any().any()
229-
and rhs.shape == (10, 5)
230-
and np_version_under1p17
231-
and is_platform_windows()
232-
and compat.PY38
233-
):
234-
mark = pytest.mark.xfail(
235-
reason="GH#37328 floating point precision on Windows builds"
236-
)
237-
request.node.add_marker(mark)
238-
239219
self.check_binary_arith_op(lhs, op, rhs)
240220

241221
def test_modulus(self, lhs, rhs):

pandas/tests/extension/base/dim2.py

-19
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,10 @@
44
import numpy as np
55
import pytest
66

7-
from pandas.compat import np_version_under1p17
8-
97
import pandas as pd
10-
from pandas.core.arrays import (
11-
FloatingArray,
12-
IntegerArray,
13-
)
148
from pandas.tests.extension.base.base import BaseExtensionTests
159

1610

17-
def maybe_xfail_masked_reductions(arr, request):
18-
if (
19-
isinstance(arr, (FloatingArray, IntegerArray))
20-
and np_version_under1p17
21-
and arr.ndim == 2
22-
):
23-
mark = pytest.mark.xfail(reason="masked_reductions does not implement")
24-
request.node.add_marker(mark)
25-
26-
2711
class Dim2CompatTests(BaseExtensionTests):
2812
def test_swapaxes(self, data):
2913
arr2d = data.repeat(2).reshape(-1, 2)
@@ -148,7 +132,6 @@ def test_reductions_2d_axis_none(self, data, method, request):
148132
pytest.skip("test is not applicable for this type/dtype")
149133

150134
arr2d = data.reshape(1, -1)
151-
maybe_xfail_masked_reductions(arr2d, request)
152135

153136
err_expected = None
154137
err_result = None
@@ -177,7 +160,6 @@ def test_reductions_2d_axis0(self, data, method, request):
177160
pytest.skip("test is not applicable for this type/dtype")
178161

179162
arr2d = data.reshape(1, -1)
180-
maybe_xfail_masked_reductions(arr2d, request)
181163

182164
kwargs = {}
183165
if method == "std":
@@ -225,7 +207,6 @@ def test_reductions_2d_axis1(self, data, method, request):
225207
pytest.skip("test is not applicable for this type/dtype")
226208

227209
arr2d = data.reshape(1, -1)
228-
maybe_xfail_masked_reductions(arr2d, request)
229210

230211
try:
231212
result = getattr(arr2d, method)(axis=1)

pandas/tests/frame/methods/test_sample.py

+2-12
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 import np_version_under1p17
5-
64
from pandas import (
75
DataFrame,
86
Series,
@@ -155,16 +153,8 @@ def test_sample_none_weights(self, obj):
155153
"func_str,arg",
156154
[
157155
("np.array", [2, 3, 1, 0]),
158-
pytest.param(
159-
"np.random.MT19937",
160-
3,
161-
marks=pytest.mark.skipif(np_version_under1p17, reason="NumPy<1.17"),
162-
),
163-
pytest.param(
164-
"np.random.PCG64",
165-
11,
166-
marks=pytest.mark.skipif(np_version_under1p17, reason="NumPy<1.17"),
167-
),
156+
("np.random.MT19937", 3),
157+
("np.random.PCG64", 11),
168158
],
169159
)
170160
def test_sample_random_state(self, func_str, arg, frame_or_series):

pandas/tests/indexes/multi/test_analytics.py

+5-11
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 import np_version_under1p17
5-
64
import pandas as pd
75
from pandas import (
86
Index,
@@ -246,15 +244,11 @@ def test_numpy_ufuncs(idx, func):
246244
# test ufuncs of numpy. see:
247245
# https://numpy.org/doc/stable/reference/ufuncs.html
248246

249-
if np_version_under1p17:
250-
expected_exception = AttributeError
251-
msg = f"'tuple' object has no attribute '{func.__name__}'"
252-
else:
253-
expected_exception = TypeError
254-
msg = (
255-
"loop of ufunc does not support argument 0 of type tuple which "
256-
f"has no callable {func.__name__} method"
257-
)
247+
expected_exception = TypeError
248+
msg = (
249+
"loop of ufunc does not support argument 0 of type tuple which "
250+
f"has no callable {func.__name__} method"
251+
)
258252
with pytest.raises(expected_exception, match=msg):
259253
func(idx)
260254

pandas/tests/indexes/test_numpy_compat.py

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import numpy as np
22
import pytest
33

4-
from pandas.compat import (
5-
np_version_under1p17,
6-
np_version_under1p18,
7-
)
4+
from pandas.compat import np_version_under1p18
85

96
from pandas import (
107
DatetimeIndex,
@@ -81,18 +78,12 @@ def test_numpy_ufuncs_other(index, func, request):
8178
# test ufuncs of numpy, see:
8279
# https://numpy.org/doc/stable/reference/ufuncs.html
8380
if isinstance(index, (DatetimeIndex, TimedeltaIndex)):
84-
if isinstance(index, DatetimeIndex) and index.tz is not None:
85-
if func in [np.isfinite, np.isnan, np.isinf]:
86-
if not np_version_under1p17:
87-
mark = pytest.mark.xfail(reason="__array_ufunc__ is not defined")
88-
request.node.add_marker(mark)
89-
9081
if not np_version_under1p18 and func in [np.isfinite, np.isinf, np.isnan]:
9182
# numpy 1.18(dev) changed isinf and isnan to not raise on dt64/tfd64
9283
result = func(index)
9384
assert isinstance(result, np.ndarray)
9485

95-
elif not np_version_under1p17 and func in [np.isfinite]:
86+
elif func in [np.isfinite]:
9687
# ok under numpy >= 1.17
9788
# Results in bool array
9889
result = func(index)

pandas/tests/test_common.py

+8-11
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import numpy as np
77
import pytest
88

9-
from pandas.compat import np_version_under1p17
10-
119
import pandas as pd
1210
from pandas import Series
1311
import pandas._testing as tm
@@ -72,15 +70,14 @@ def test_random_state():
7270

7371
# Check BitGenerators
7472
# GH32503
75-
if not np_version_under1p17:
76-
assert (
77-
com.random_state(npr.MT19937(3)).uniform()
78-
== npr.RandomState(npr.MT19937(3)).uniform()
79-
)
80-
assert (
81-
com.random_state(npr.PCG64(11)).uniform()
82-
== npr.RandomState(npr.PCG64(11)).uniform()
83-
)
73+
assert (
74+
com.random_state(npr.MT19937(3)).uniform()
75+
== npr.RandomState(npr.MT19937(3)).uniform()
76+
)
77+
assert (
78+
com.random_state(npr.PCG64(11)).uniform()
79+
== npr.RandomState(npr.PCG64(11)).uniform()
80+
)
8481

8582
# Error for floats or strings
8683
msg = (

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ requires = [
55
"setuptools>=38.6.0",
66
"wheel",
77
"Cython>=0.29.21,<3", # Note: sync with setup.py
8-
"numpy==1.16.5; python_version=='3.7'",
9-
"numpy==1.17.3; python_version=='3.8'",
8+
"numpy==1.17.3; python_version=='3.7'",
9+
"numpy==1.18.3; python_version=='3.8'",
1010
"numpy; python_version>='3.9'",
1111
]
1212
# uncomment to enable pep517 after versioneer problem is fixed.

requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file is auto-generated from environment.yml, do not modify.
22
# See that file for comments about the need/usage of each dependency.
33

4-
numpy>=1.16.5
4+
numpy>=1.17.3
55
python-dateutil>=2.7.3
66
pytz
77
asv

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ project_urls =
3131
[options]
3232
packages = find:
3333
install_requires =
34-
numpy>=1.16.5
34+
numpy>=1.17.3
3535
python-dateutil>=2.7.3
3636
pytz>=2017.3
3737
python_requires = >=3.7.1

0 commit comments

Comments
 (0)