Skip to content

DEPS: drop np 18 supoort #47226

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
Jun 5, 2022
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
2 changes: 1 addition & 1 deletion ci/deps/actions-38-minimum_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ Dependencies
================================================================ ==========================
Package Minimum supported version
================================================================ ==========================
`NumPy <https://numpy.org>`__ 1.18.5
`NumPy <https://numpy.org>`__ 1.19.5
`python-dateutil <https://dateutil.readthedocs.io/en/stable/>`__ 2.8.1
`pytz <https://pypi.org/project/pytz/>`__ 2020.1
================================================================ ==========================
Expand Down
2 changes: 2 additions & 0 deletions doc/source/whatsnew/v1.5.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions pandas/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -145,7 +144,6 @@ def get_lzma_file():

__all__ = [
"is_numpy_dev",
"np_version_under1p19",
"np_version_under1p20",
"pa_version_under1p01",
"pa_version_under2p0",
Expand Down
3 changes: 1 addition & 2 deletions pandas/compat/numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 2 additions & 8 deletions pandas/tests/frame/indexing/test_where.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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'"

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions pandas/tests/frame/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
23 changes: 3 additions & 20 deletions pandas/tests/series/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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})])
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down