From 5fc213e3bee151da23a7d241fee412000bcabb19 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke Date: Sun, 30 Jan 2022 19:43:10 -0800 Subject: [PATCH 1/2] TST: Add @td.skip_if_no_scipy to failing test --- pandas/tests/series/methods/test_interpolate.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/tests/series/methods/test_interpolate.py b/pandas/tests/series/methods/test_interpolate.py index 908e35b20dced..c46f427fd6f09 100644 --- a/pandas/tests/series/methods/test_interpolate.py +++ b/pandas/tests/series/methods/test_interpolate.py @@ -778,6 +778,7 @@ def test_interp_non_timedelta_index(self, interp_methods_ind, ind): with pytest.raises(ValueError, match=expected_error): df[0].interpolate(method=method, **kwargs) + @td.skip_if_no_scipy def test_interpolate_timedelta_index(self, request, interp_methods_ind): """ Tests for non numerical index types - object, period, timedelta @@ -789,8 +790,6 @@ def test_interpolate_timedelta_index(self, request, interp_methods_ind): df = pd.DataFrame([0, 1, np.nan, 3], index=ind) method, kwargs = interp_methods_ind - if method == "pchip": - pytest.importorskip("scipy") if method in {"cubic", "zero"}: request.node.add_marker( From fcebed05f22e055207daa72fcff95def180e57d4 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke Date: Sun, 30 Jan 2022 21:47:32 -0800 Subject: [PATCH 2/2] Fix min build for scipy --- pandas/tests/series/methods/test_interpolate.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandas/tests/series/methods/test_interpolate.py b/pandas/tests/series/methods/test_interpolate.py index c46f427fd6f09..bd8b165335d09 100644 --- a/pandas/tests/series/methods/test_interpolate.py +++ b/pandas/tests/series/methods/test_interpolate.py @@ -12,6 +12,7 @@ isna, ) import pandas._testing as tm +from pandas.util.version import Version @pytest.fixture( @@ -790,8 +791,11 @@ def test_interpolate_timedelta_index(self, request, interp_methods_ind): df = pd.DataFrame([0, 1, np.nan, 3], index=ind) method, kwargs = interp_methods_ind + import scipy - if method in {"cubic", "zero"}: + if method in {"cubic", "zero"} or ( + method == "barycentric" and Version(scipy.__version__) < Version("1.5.0") + ): request.node.add_marker( pytest.mark.xfail( reason=f"{method} interpolation is not supported for TimedeltaIndex"