Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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 @@ -19,7 +19,7 @@ dependencies:

# required dependencies
- python-dateutil=2.8.2
- numpy=1.20.3
- numpy=1.21.6
- 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 @@ -260,7 +260,7 @@ pandas requires the following dependencies.
================================================================ ==========================
Package Minimum supported version
================================================================ ==========================
`NumPy <https://numpy.org>`__ 1.20.3
`NumPy <https://numpy.org>`__ 1.21.6
`python-dateutil <https://dateutil.readthedocs.io/en/stable/>`__ 2.8.2
`pytz <https://pypi.org/project/pytz/>`__ 2020.1
================================================================ ==========================
Expand Down
6 changes: 1 addition & 5 deletions pandas/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
PYPY,
)
import pandas.compat.compressors
from pandas.compat.numpy import (
is_numpy_dev,
np_version_under1p21,
)
from pandas.compat.numpy import is_numpy_dev
from pandas.compat.pyarrow import (
pa_version_under7p0,
pa_version_under8p0,
Expand Down Expand Up @@ -159,7 +156,6 @@ def get_lzma_file() -> type[pandas.compat.compressors.LZMAFile]:

__all__ = [
"is_numpy_dev",
"np_version_under1p21",
"pa_version_under7p0",
"pa_version_under8p0",
"pa_version_under9p0",
Expand Down
9 changes: 2 additions & 7 deletions pandas/compat/numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,12 @@
# numpy versioning
_np_version = np.__version__
_nlv = Version(_np_version)
np_version_under1p21 = _nlv < Version("1.21")
np_version_under1p22 = _nlv < Version("1.22")
np_version_gte1p22 = _nlv >= Version("1.22")
np_version_gte1p24 = _nlv >= Version("1.24")
is_numpy_dev = _nlv.dev is not None
_min_numpy_ver = "1.20.3"
_min_numpy_ver = "1.21.6"

if is_numpy_dev or not np_version_under1p22:
np_percentile_argname = "method"
else:
np_percentile_argname = "interpolation"
np_percentile_argname = "interpolation" if np_version_under1p22 else "method"


if _nlv < Version(_min_numpy_ver):
Expand Down
4 changes: 0 additions & 4 deletions pandas/core/array_algos/putmask.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import numpy as np

from pandas._libs import lib
from pandas.compat import np_version_under1p21

from pandas.core.dtypes.cast import infer_dtype_from
from pandas.core.dtypes.common import is_list_like
Expand Down Expand Up @@ -73,9 +72,6 @@ def putmask_without_repeat(
mask : np.ndarray[bool]
new : Any
"""
if np_version_under1p21:
new = setitem_datetimelike_compat(values, mask.sum(), new)

if getattr(new, "ndim", 0) >= 1:
new = new.astype(values.dtype, copy=False)

Expand Down
9 changes: 3 additions & 6 deletions pandas/tests/extension/base/casting.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import numpy as np
import pytest

from pandas.compat import np_version_under1p21
import pandas.util._test_decorators as td

import pandas as pd
Expand Down Expand Up @@ -31,11 +30,9 @@ def test_astype_object_frame(self, all_data):
assert isinstance(result._mgr.arrays[0], np.ndarray)
assert result._mgr.arrays[0].dtype == np.dtype(object)

# earlier numpy raises TypeError on e.g. np.dtype(np.int64) == "Int64"
if not np_version_under1p21:
# check that we can compare the dtypes
comp = result.dtypes == df.dtypes
assert not comp.any()
# check that we can compare the dtypes
comp = result.dtypes == df.dtypes
assert not comp.any()

def test_tolist(self, data):
result = pd.Series(data).tolist()
Expand Down
15 changes: 1 addition & 14 deletions pandas/tests/frame/methods/test_quantile.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import numpy as np
import pytest

from pandas.compat.numpy import (
np_percentile_argname,
np_version_under1p21,
)
from pandas.compat.numpy import np_percentile_argname

import pandas as pd
from pandas import (
Expand Down Expand Up @@ -848,11 +845,6 @@ def test_quantile_ea(self, request, obj, index):
qs = [0.5, 0, 1]
result = self.compute_quantile(obj, qs)

if np_version_under1p21 and index.dtype == "timedelta64[ns]":
msg = "failed on Numpy 1.20.3; TypeError: data type 'Int64' not understood"
mark = pytest.mark.xfail(reason=msg, raises=TypeError)
request.node.add_marker(mark)

exp_dtype = index.dtype
if index.dtype == "Int64":
# match non-nullable casting behavior
Expand Down Expand Up @@ -914,11 +906,6 @@ def test_quantile_ea_scalar(self, request, obj, index):
qs = 0.5
result = self.compute_quantile(obj, qs)

if np_version_under1p21 and index.dtype == "timedelta64[ns]":
msg = "failed on Numpy 1.20.3; TypeError: data type 'Int64' not understood"
mark = pytest.mark.xfail(reason=msg, raises=TypeError)
request.node.add_marker(mark)

exp_dtype = index.dtype
if index.dtype == "Int64":
exp_dtype = "Float64"
Expand Down