Skip to content

Commit 9919d55

Browse files
jbrockmendelAlexKirko
authored andcommitted
CLN: remove unnecessary scipy attr checks (pandas-dev#30450)
1 parent 507c8af commit 9919d55

File tree

2 files changed

+2
-33
lines changed

2 files changed

+2
-33
lines changed

pandas/tests/frame/test_missing.py

-11
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@
1212
import pandas.util.testing as tm
1313

1414

15-
def _skip_if_no_pchip():
16-
try:
17-
from scipy.interpolate import pchip_interpolate # noqa
18-
except ImportError:
19-
import pytest
20-
21-
pytest.skip("scipy.interpolate.pchip missing")
22-
23-
2415
class TestDataFrameMissingData:
2516
def test_dropEmptyRows(self, float_frame):
2617
N = len(float_frame.index)
@@ -837,8 +828,6 @@ def test_interp_alt_scipy(self):
837828
expectedk["A"] = expected["A"]
838829
tm.assert_frame_equal(result, expectedk)
839830

840-
_skip_if_no_pchip()
841-
842831
result = df.interpolate(method="pchip")
843832
expected.loc[2, "A"] = 3
844833
expected.loc[5, "A"] = 6.0

pandas/tests/series/test_missing.py

+2-22
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,6 @@
2424
import pandas.util.testing as tm
2525

2626

27-
def _skip_if_no_pchip():
28-
try:
29-
from scipy.interpolate import pchip_interpolate # noqa
30-
except ImportError:
31-
import pytest
32-
33-
pytest.skip("scipy.interpolate.pchip missing")
34-
35-
36-
def _skip_if_no_akima():
37-
try:
38-
from scipy.interpolate import Akima1DInterpolator # noqa
39-
except ImportError:
40-
import pytest
41-
42-
pytest.skip("scipy.interpolate.Akima1DInterpolator missing")
43-
44-
4527
def _simple_ts(start, end, freq="D"):
4628
rng = date_range(start, end, freq=freq)
4729
return Series(np.random.randn(len(rng)), index=rng)
@@ -1099,7 +1081,6 @@ def test_interpolate_time_raises_for_non_timeseries(self):
10991081

11001082
@td.skip_if_no_scipy
11011083
def test_interpolate_pchip(self):
1102-
_skip_if_no_pchip()
11031084

11041085
ser = Series(np.sort(np.random.uniform(size=100)))
11051086

@@ -1113,7 +1094,6 @@ def test_interpolate_pchip(self):
11131094

11141095
@td.skip_if_no_scipy
11151096
def test_interpolate_akima(self):
1116-
_skip_if_no_akima()
11171097

11181098
ser = Series([10, 11, 12, 13])
11191099

@@ -1619,7 +1599,7 @@ def test_interp_non_timedelta_index(self, interp_methods_ind, ind):
16191599

16201600
method, kwargs = interp_methods_ind
16211601
if method == "pchip":
1622-
_skip_if_no_pchip()
1602+
pytest.importorskip("scipy")
16231603

16241604
if method == "linear":
16251605
result = df[0].interpolate(**kwargs)
@@ -1647,7 +1627,7 @@ def test_interpolate_timedelta_index(self, interp_methods_ind):
16471627

16481628
method, kwargs = interp_methods_ind
16491629
if method == "pchip":
1650-
_skip_if_no_pchip()
1630+
pytest.importorskip("scipy")
16511631

16521632
if method in {"linear", "pchip"}:
16531633
result = df[0].interpolate(method=method, **kwargs)

0 commit comments

Comments
 (0)