diff --git a/ci/deps/actions-38-minimum_versions.yaml b/ci/deps/actions-38-minimum_versions.yaml index f68e3e31b5433..3ab27830060b2 100644 --- a/ci/deps/actions-38-minimum_versions.yaml +++ b/ci/deps/actions-38-minimum_versions.yaml @@ -17,7 +17,7 @@ dependencies: # required dependencies - python-dateutil=2.8.1 - - numpy=1.18.5 + - numpy=1.19.5 - pytz=2020.1 # optional dependencies diff --git a/doc/source/getting_started/install.rst b/doc/source/getting_started/install.rst index adc8b3d08d441..39c9db2c883b8 100644 --- a/doc/source/getting_started/install.rst +++ b/doc/source/getting_started/install.rst @@ -235,7 +235,7 @@ Dependencies ================================================================ ========================== Package Minimum supported version ================================================================ ========================== -`NumPy `__ 1.18.5 +`NumPy `__ 1.19.5 `python-dateutil `__ 2.8.1 `pytz `__ 2020.1 ================================================================ ========================== diff --git a/doc/source/whatsnew/v1.5.0.rst b/doc/source/whatsnew/v1.5.0.rst index 6bf6fd65f5633..82e60f80953ae 100644 --- a/doc/source/whatsnew/v1.5.0.rst +++ b/doc/source/whatsnew/v1.5.0.rst @@ -362,6 +362,8 @@ If installed, we now require: +-----------------+-----------------+----------+---------+ | Package | Minimum Version | Required | Changed | +=================+=================+==========+=========+ +| numpy | 1.19.5 | X | X | ++-----------------+-----------------+----------+---------+ | mypy (dev) | 0.960 | | X | +-----------------+-----------------+----------+---------+ | beautifulsoup4 | 4.9.3 | | X | diff --git a/environment.yml b/environment.yml index 4131d0c814b60..1f1583354339c 100644 --- a/environment.yml +++ b/environment.yml @@ -3,7 +3,7 @@ channels: - conda-forge dependencies: # required - - numpy>=1.18.5 + - numpy>=1.19.5 - python=3.8 - python-dateutil>=2.8.1 - pytz diff --git a/pandas/compat/__init__.py b/pandas/compat/__init__.py index bc8948cc8aee1..bb4787f07b2f0 100644 --- a/pandas/compat/__init__.py +++ b/pandas/compat/__init__.py @@ -14,7 +14,6 @@ from pandas._typing import F from pandas.compat.numpy import ( is_numpy_dev, - np_version_under1p19, np_version_under1p20, ) from pandas.compat.pyarrow import ( @@ -145,7 +144,6 @@ def get_lzma_file(): __all__ = [ "is_numpy_dev", - "np_version_under1p19", "np_version_under1p20", "pa_version_under1p01", "pa_version_under2p0", diff --git a/pandas/compat/numpy/__init__.py b/pandas/compat/numpy/__init__.py index 623c5fbecc48c..f9c43592d5f62 100644 --- a/pandas/compat/numpy/__init__.py +++ b/pandas/compat/numpy/__init__.py @@ -6,12 +6,11 @@ # numpy versioning _np_version = np.__version__ _nlv = Version(_np_version) -np_version_under1p19 = _nlv < Version("1.19") np_version_under1p20 = _nlv < Version("1.20") np_version_under1p22 = _nlv < Version("1.22") np_version_gte1p22 = _nlv >= Version("1.22") is_numpy_dev = _nlv.dev is not None -_min_numpy_ver = "1.18.5" +_min_numpy_ver = "1.19.5" if is_numpy_dev or not np_version_under1p22: np_percentile_argname = "method" diff --git a/pandas/tests/frame/indexing/test_where.py b/pandas/tests/frame/indexing/test_where.py index d65a5ebe56ee2..9d004613116b8 100644 --- a/pandas/tests/frame/indexing/test_where.py +++ b/pandas/tests/frame/indexing/test_where.py @@ -4,7 +4,7 @@ import numpy as np import pytest -from pandas.compat import np_version_under1p19 +from pandas.compat import np_version_under1p20 from pandas.core.dtypes.common import is_scalar @@ -918,13 +918,6 @@ def test_where_period_invalid_na(frame_or_series, as_cat, request): r"Cannot setitem on a Categorical with a new category \(NaT\), " "set the categories first" ) - if np_version_under1p19: - mark = pytest.mark.xfail( - reason="When evaluating the f-string to generate the exception " - "message, numpy somehow ends up trying to cast None to int, so " - "ends up raising TypeError but with an unrelated message." - ) - request.node.add_marker(mark) else: msg = "value should be a 'Period'" @@ -1013,6 +1006,7 @@ def _check_where_equivalences(df, mask, other, expected): tm.assert_frame_equal(df, expected) +@pytest.mark.xfail(np_version_under1p20, reason="failed on Numpy 1.19.5") def test_where_dt64_2d(): dti = date_range("2016-01-01", periods=6) dta = dti._data.reshape(3, 2) diff --git a/pandas/tests/frame/test_constructors.py b/pandas/tests/frame/test_constructors.py index e62c050fbf812..5360885067c7a 100644 --- a/pandas/tests/frame/test_constructors.py +++ b/pandas/tests/frame/test_constructors.py @@ -18,7 +18,6 @@ import pytest import pytz -from pandas.compat import np_version_under1p19 import pandas.util._test_decorators as td from pandas.core.dtypes.common import is_integer_dtype @@ -308,7 +307,6 @@ def test_constructor_dtype_list_data(self): assert df.loc[1, 0] is None assert df.loc[0, 1] == "2" - @pytest.mark.skipif(np_version_under1p19, reason="NumPy change.") def test_constructor_list_of_2d_raises(self): # https://github.com/pandas-dev/pandas/issues/32289 a = DataFrame() diff --git a/pandas/tests/series/test_constructors.py b/pandas/tests/series/test_constructors.py index e0b180bf0c6f4..3dce22a06c1b2 100644 --- a/pandas/tests/series/test_constructors.py +++ b/pandas/tests/series/test_constructors.py @@ -13,10 +13,7 @@ iNaT, lib, ) -from pandas.compat.numpy import ( - np_version_under1p19, - np_version_under1p20, -) +from pandas.compat.numpy import np_version_under1p20 import pandas.util._test_decorators as td from pandas.core.dtypes.common import ( @@ -818,18 +815,11 @@ def test_constructor_coerce_float_valid(self, float_numpy_dtype): expected = Series([1, 2, 3.5]).astype(float_numpy_dtype) tm.assert_series_equal(s, expected) - def test_constructor_invalid_coerce_ints_with_float_nan( - self, any_int_numpy_dtype, request - ): + def test_constructor_invalid_coerce_ints_with_float_nan(self, any_int_numpy_dtype): # GH 22585 # Updated: make sure we treat this list the same as we would treat the - # equivalent ndarray - if np_version_under1p19 and np.dtype(any_int_numpy_dtype).kind == "u": - mark = pytest.mark.xfail(reason="Produces an extra RuntimeWarning") - request.node.add_marker(mark) - + # equivalent ndarray vals = [1, 2, np.nan] - msg = "In a future version, passing float-dtype values containing NaN" with tm.assert_produces_warning(FutureWarning, match=msg): res = Series(vals, dtype=any_int_numpy_dtype) @@ -1958,13 +1948,6 @@ def test_constructor(rand_series_with_duplicate_datetimeindex): ({1: 1}, np.array([[1]], dtype=np.int64)), ], ) -@pytest.mark.skipif(np_version_under1p19, reason="fails on numpy below 1.19") def test_numpy_array(input_dict, expected): result = np.array([Series(input_dict)]) tm.assert_numpy_array_equal(result, expected) - - -@pytest.mark.xfail(not np_version_under1p19, reason="check failure on numpy below 1.19") -def test_numpy_array_np_v1p19(): - with pytest.raises(KeyError, match="0"): - np.array([Series({1: 1})]) diff --git a/requirements-dev.txt b/requirements-dev.txt index 9f80194775167..7640587b85a1c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,7 @@ # This file is auto-generated from environment.yml, do not modify. # See that file for comments about the need/usage of each dependency. -numpy>=1.18.5 +numpy>=1.19.5 python-dateutil>=2.8.1 pytz asv