diff --git a/pandas/__init__.py b/pandas/__init__.py index cd697b757a26a..d6f3458b4d604 100644 --- a/pandas/__init__.py +++ b/pandas/__init__.py @@ -24,6 +24,7 @@ _np_version_under1p15, _np_version_under1p16, _np_version_under1p17, + _np_version_under1p18, ) try: diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index 1282aa6edd538..85e38d58a6c57 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -189,6 +189,7 @@ class TestPDApi(Base): "_np_version_under1p15", "_np_version_under1p16", "_np_version_under1p17", + "_np_version_under1p18", "_tslib", "_typing", "_version", diff --git a/pandas/tests/indexes/test_numpy_compat.py b/pandas/tests/indexes/test_numpy_compat.py index 6626ccf4a29f8..3d24c70afdda2 100644 --- a/pandas/tests/indexes/test_numpy_compat.py +++ b/pandas/tests/indexes/test_numpy_compat.py @@ -6,9 +6,11 @@ Float64Index, Index, Int64Index, + PeriodIndex, TimedeltaIndex, UInt64Index, _np_version_under1p17, + _np_version_under1p18, ) from pandas.core.indexes.datetimelike import DatetimeIndexOpsMixin import pandas.util.testing as tm @@ -80,18 +82,22 @@ def test_numpy_ufuncs_other(indices, func): idx = indices if isinstance(idx, (DatetimeIndex, TimedeltaIndex)): - # ok under numpy >= 1.17 - if not _np_version_under1p17 and func in [np.isfinite]: + if not _np_version_under1p18 and func in [np.isfinite, np.isinf, np.isnan]: + # numpy 1.18(dev) changed isinf and isnan to not raise on dt64/tfd64 + result = func(idx) + assert isinstance(result, np.ndarray) + + elif not _np_version_under1p17 and func in [np.isfinite]: + # ok under numpy >= 1.17 # Results in bool array result = func(idx) assert isinstance(result, np.ndarray) - assert not isinstance(result, Index) else: # raise TypeError or ValueError (PeriodIndex) with pytest.raises(Exception): func(idx) - elif isinstance(idx, DatetimeIndexOpsMixin): + elif isinstance(idx, PeriodIndex): # raise TypeError or ValueError (PeriodIndex) with pytest.raises(Exception): func(idx) diff --git a/pandas/tests/reshape/test_concat.py b/pandas/tests/reshape/test_concat.py index 667fe689861be..bb8339439d339 100644 --- a/pandas/tests/reshape/test_concat.py +++ b/pandas/tests/reshape/test_concat.py @@ -765,13 +765,15 @@ def test_concat_join_axes_deprecated(self, axis): ) expected = pd.concat([one, two], axis=1, sort=False).reindex(index=two.index) - result = pd.concat([one, two], axis=1, sort=False, join_axes=[two.index]) + with tm.assert_produces_warning(FutureWarning): + result = pd.concat([one, two], axis=1, sort=False, join_axes=[two.index]) tm.assert_frame_equal(result, expected) expected = pd.concat([one, two], axis=0, sort=False).reindex( columns=two.columns ) - result = pd.concat([one, two], axis=0, sort=False, join_axes=[two.columns]) + with tm.assert_produces_warning(FutureWarning): + result = pd.concat([one, two], axis=0, sort=False, join_axes=[two.columns]) tm.assert_frame_equal(result, expected)