From 81093ba8214476e979ea55765d7ddb609f729ac9 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Fri, 1 May 2020 12:38:38 -0700 Subject: [PATCH] BLD: bump numpy min version to 1.15.4 (#33729) --- ci/deps/azure-36-minimum_versions.yaml | 5 ++--- ci/deps/azure-macos-36.yaml | 2 +- conda.recipe/meta.yaml | 4 ++-- doc/source/getting_started/install.rst | 2 +- doc/source/whatsnew/v1.1.0.rst | 16 +++++++++++++--- environment.yml | 2 +- pandas/__init__.py | 2 -- pandas/compat/_optional.py | 2 +- pandas/compat/numpy/__init__.py | 10 +++------- pandas/tests/api/test_api.py | 2 -- pandas/tests/dtypes/cast/test_promote.py | 15 +++++++-------- pandas/tests/extension/test_boolean.py | 5 ----- pandas/tests/frame/methods/test_astype.py | 5 +---- pyproject.toml | 4 ++-- requirements-dev.txt | 2 +- setup.py | 2 +- 16 files changed, 36 insertions(+), 44 deletions(-) diff --git a/ci/deps/azure-36-minimum_versions.yaml b/ci/deps/azure-36-minimum_versions.yaml index ae8fffa59fd50..f5af7bcf36189 100644 --- a/ci/deps/azure-36-minimum_versions.yaml +++ b/ci/deps/azure-36-minimum_versions.yaml @@ -1,6 +1,5 @@ name: pandas-dev channels: - - defaults - conda-forge dependencies: - python=3.6.1 @@ -19,12 +18,12 @@ dependencies: - jinja2=2.8 - numba=0.46.0 - numexpr=2.6.2 - - numpy=1.13.3 + - numpy=1.15.4 - openpyxl=2.5.7 - pytables=3.4.3 - python-dateutil=2.7.3 - pytz=2017.2 - - scipy=0.19.0 + - scipy=1.2 - xlrd=1.1.0 - xlsxwriter=0.9.8 - xlwt=1.2.0 diff --git a/ci/deps/azure-macos-36.yaml b/ci/deps/azure-macos-36.yaml index 93885afbc4114..eeea249a19ca1 100644 --- a/ci/deps/azure-macos-36.yaml +++ b/ci/deps/azure-macos-36.yaml @@ -19,7 +19,7 @@ dependencies: - matplotlib=2.2.3 - nomkl - numexpr - - numpy=1.14 + - numpy=1.15.4 - openpyxl - pyarrow>=0.13.0 - pytables diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 47f63c11d0567..e833ea1f1f398 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -20,12 +20,12 @@ requirements: - cython - numpy - setuptools >=3.3 - - python-dateutil >=2.5.0 + - python-dateutil >=2.7.3 - pytz run: - python {{ python }} - {{ pin_compatible('numpy') }} - - python-dateutil >=2.5.0 + - python-dateutil >=2.7.3 - pytz test: diff --git a/doc/source/getting_started/install.rst b/doc/source/getting_started/install.rst index d392e151e3f97..ba99aaa9f430c 100644 --- a/doc/source/getting_started/install.rst +++ b/doc/source/getting_started/install.rst @@ -220,7 +220,7 @@ Dependencies Package Minimum supported version ================================================================ ========================== `setuptools `__ 24.2.0 -`NumPy `__ 1.13.3 +`NumPy `__ 1.15.4 `python-dateutil `__ 2.7.3 `pytz `__ 2017.2 ================================================================ ========================== diff --git a/doc/source/whatsnew/v1.1.0.rst b/doc/source/whatsnew/v1.1.0.rst index fc2b8c98a42bb..4da95cad915bf 100644 --- a/doc/source/whatsnew/v1.1.0.rst +++ b/doc/source/whatsnew/v1.1.0.rst @@ -157,13 +157,23 @@ Other enhancements Increased minimum versions for dependencies ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Some minimum supported versions of dependencies were updated (:issue:`29766`, :issue:`29723`, pytables >= 3.4.3). +Some minimum supported versions of dependencies were updated (:issue:`33718`, :issue:`29766`, :issue:`29723`, pytables >= 3.4.3). If installed, we now require: +-----------------+-----------------+----------+---------+ | Package | Minimum Version | Required | Changed | +=================+=================+==========+=========+ -| python-dateutil | 2.7.3 | X | | +| numpy | 1.15.4 | X | X | ++-----------------+-----------------+----------+---------+ +| pytz | 2015.4 | X | | ++-----------------+-----------------+----------+---------+ +| python-dateutil | 2.7.3 | X | X | ++-----------------+-----------------+----------+---------+ +| bottleneck | 1.2.1 | | | ++-----------------+-----------------+----------+---------+ +| numexpr | 2.6.2 | | | ++-----------------+-----------------+----------+---------+ +| pytest (dev) | 4.0.2 | | | +-----------------+-----------------+----------+---------+ For `optional libraries `_ the general recommendation is to use the latest version. @@ -195,7 +205,7 @@ Optional libraries below the lowest tested version may still work, but are not c +-----------------+-----------------+---------+ | s3fs | 0.3.0 | | +-----------------+-----------------+---------+ -| scipy | 0.19.0 | | +| scipy | 1.2.0 | X | +-----------------+-----------------+---------+ | sqlalchemy | 1.1.4 | | +-----------------+-----------------+---------+ diff --git a/environment.yml b/environment.yml index 8893302b4c9b2..bc7c715104ce5 100644 --- a/environment.yml +++ b/environment.yml @@ -75,7 +75,7 @@ dependencies: - jinja2 # pandas.Styler - matplotlib>=2.2.2 # pandas.plotting, Series.plot, DataFrame.plot - numexpr>=2.6.8 - - scipy>=1.1 + - scipy>=1.2 - numba>=0.46.0 # optional for io diff --git a/pandas/__init__.py b/pandas/__init__.py index 2b9a461e0e95d..d6584bf4f1c4f 100644 --- a/pandas/__init__.py +++ b/pandas/__init__.py @@ -20,8 +20,6 @@ # numpy compat from pandas.compat.numpy import ( - _np_version_under1p14, - _np_version_under1p15, _np_version_under1p16, _np_version_under1p17, _np_version_under1p18, diff --git a/pandas/compat/_optional.py b/pandas/compat/_optional.py index 7e253a52a9c00..c5fd294699c45 100644 --- a/pandas/compat/_optional.py +++ b/pandas/compat/_optional.py @@ -21,7 +21,7 @@ "pytest": "5.0.1", "pyxlsb": "1.0.6", "s3fs": "0.3.0", - "scipy": "0.19.0", + "scipy": "1.2.0", "sqlalchemy": "1.1.4", "tables": "3.4.3", "tabulate": "0.8.3", diff --git a/pandas/compat/numpy/__init__.py b/pandas/compat/numpy/__init__.py index 6c9ac5944e6a1..a8f49d91f040e 100644 --- a/pandas/compat/numpy/__init__.py +++ b/pandas/compat/numpy/__init__.py @@ -8,19 +8,17 @@ # numpy versioning _np_version = np.__version__ _nlv = LooseVersion(_np_version) -_np_version_under1p14 = _nlv < LooseVersion("1.14") -_np_version_under1p15 = _nlv < LooseVersion("1.15") _np_version_under1p16 = _nlv < LooseVersion("1.16") _np_version_under1p17 = _nlv < LooseVersion("1.17") _np_version_under1p18 = _nlv < LooseVersion("1.18") _is_numpy_dev = ".dev" in str(_nlv) -if _nlv < "1.13.3": +if _nlv < "1.15.4": raise ImportError( - "this version of pandas is incompatible with numpy < 1.13.3\n" + "this version of pandas is incompatible with numpy < 1.15.4\n" f"your numpy version is {_np_version}.\n" - "Please upgrade numpy to >= 1.13.3 to use this pandas version" + "Please upgrade numpy to >= 1.15.4 to use this pandas version" ) @@ -65,8 +63,6 @@ def np_array_datetime64_compat(arr, *args, **kwargs): __all__ = [ "np", "_np_version", - "_np_version_under1p14", - "_np_version_under1p15", "_np_version_under1p16", "_np_version_under1p17", "_is_numpy_dev", diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index 5aab5b814bae7..ecd20796b6f21 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -193,8 +193,6 @@ class TestPDApi(Base): "_hashtable", "_lib", "_libs", - "_np_version_under1p14", - "_np_version_under1p15", "_np_version_under1p16", "_np_version_under1p17", "_np_version_under1p18", diff --git a/pandas/tests/dtypes/cast/test_promote.py b/pandas/tests/dtypes/cast/test_promote.py index 69f8f46356a4d..74a11c9f33195 100644 --- a/pandas/tests/dtypes/cast/test_promote.py +++ b/pandas/tests/dtypes/cast/test_promote.py @@ -98,14 +98,13 @@ def _assert_match(result_fill_value, expected_fill_value): # GH#23982/25425 require the same type in addition to equality/NA-ness res_type = type(result_fill_value) ex_type = type(expected_fill_value) - if res_type.__name__ == "uint64": - # No idea why, but these (sometimes) do not compare as equal - assert ex_type.__name__ == "uint64" - elif res_type.__name__ == "ulonglong": - # On some builds we get this instead of np.uint64 - # Note: cant check res_type.dtype.itemsize directly on numpy 1.18 - assert res_type(0).itemsize == 8 - assert ex_type == res_type or ex_type == np.uint64 + + if hasattr(result_fill_value, "dtype"): + # Compare types in a way that is robust to platform-specific + # idiosyncracies where e.g. sometimes we get "ulonglong" as an alias + # for "uint64" or "intc" as an alias for "int32" + assert result_fill_value.dtype.kind == expected_fill_value.dtype.kind + assert result_fill_value.dtype.itemsize == expected_fill_value.dtype.itemsize else: # On some builds, type comparison fails, e.g. np.int32 != np.int32 assert res_type == ex_type or res_type.__name__ == ex_type.__name__ diff --git a/pandas/tests/extension/test_boolean.py b/pandas/tests/extension/test_boolean.py index 50b72698629bb..04dedac3e8b9b 100644 --- a/pandas/tests/extension/test_boolean.py +++ b/pandas/tests/extension/test_boolean.py @@ -16,8 +16,6 @@ import numpy as np import pytest -from pandas.compat.numpy import _np_version_under1p14 - import pandas as pd import pandas._testing as tm from pandas.core.arrays.boolean import BooleanDtype @@ -111,9 +109,6 @@ def check_opname(self, s, op_name, other, exc=None): def _check_op(self, s, op, other, op_name, exc=NotImplementedError): if exc is None: if op_name in self.implements: - # subtraction for bools raises TypeError (but not yet in 1.13) - if _np_version_under1p14: - pytest.skip("__sub__ does not yet raise in numpy 1.13") msg = r"numpy boolean subtract" with pytest.raises(TypeError, match=msg): op(s, other) diff --git a/pandas/tests/frame/methods/test_astype.py b/pandas/tests/frame/methods/test_astype.py index dc779562b662d..b06c3d72a2c77 100644 --- a/pandas/tests/frame/methods/test_astype.py +++ b/pandas/tests/frame/methods/test_astype.py @@ -14,7 +14,6 @@ Timedelta, Timestamp, UInt64Index, - _np_version_under1p14, concat, date_range, option_context, @@ -169,9 +168,7 @@ def test_astype_str_float(self): tm.assert_frame_equal(result, expected) result = DataFrame([1.12345678901234567890]).astype(str) - # < 1.14 truncates - # >= 1.14 preserves the full repr - val = "1.12345678901" if _np_version_under1p14 else "1.1234567890123457" + val = "1.1234567890123457" expected = DataFrame([val]) tm.assert_frame_equal(result, expected) diff --git a/pyproject.toml b/pyproject.toml index 696785599d7da..efeb24edbdeb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,8 +5,8 @@ requires = [ "setuptools", "wheel", "Cython>=0.29.16", # Note: sync with setup.py - "numpy==1.13.3; python_version=='3.6' and platform_system!='AIX'", - "numpy==1.14.5; python_version>='3.7' and platform_system!='AIX'", + "numpy==1.15.4; python_version=='3.6' and platform_system!='AIX'", + "numpy==1.15.4; python_version>='3.7' and platform_system!='AIX'", "numpy==1.16.0; python_version=='3.6' and platform_system=='AIX'", "numpy==1.16.0; python_version>='3.7' and platform_system=='AIX'", ] diff --git a/requirements-dev.txt b/requirements-dev.txt index 8a954fabd2d8d..5f5b5d27a03a7 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -50,7 +50,7 @@ ipython>=7.11.1 jinja2 matplotlib>=2.2.2 numexpr>=2.6.8 -scipy>=1.1 +scipy>=1.2 numba>=0.46.0 beautifulsoup4>=4.6.0 html5lib diff --git a/setup.py b/setup.py index a2e01e08e8de2..58f3fb5706ad1 100755 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ def is_platform_mac(): return sys.platform == "darwin" -min_numpy_ver = "1.13.3" +min_numpy_ver = "1.15.4" min_cython_ver = "0.29.16" # note: sync with pyproject.toml try: