24
24
import pandas .util .testing as tm
25
25
26
26
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
-
45
27
def _simple_ts (start , end , freq = "D" ):
46
28
rng = date_range (start , end , freq = freq )
47
29
return Series (np .random .randn (len (rng )), index = rng )
@@ -1099,7 +1081,6 @@ def test_interpolate_time_raises_for_non_timeseries(self):
1099
1081
1100
1082
@td .skip_if_no_scipy
1101
1083
def test_interpolate_pchip (self ):
1102
- _skip_if_no_pchip ()
1103
1084
1104
1085
ser = Series (np .sort (np .random .uniform (size = 100 )))
1105
1086
@@ -1113,7 +1094,6 @@ def test_interpolate_pchip(self):
1113
1094
1114
1095
@td .skip_if_no_scipy
1115
1096
def test_interpolate_akima (self ):
1116
- _skip_if_no_akima ()
1117
1097
1118
1098
ser = Series ([10 , 11 , 12 , 13 ])
1119
1099
@@ -1619,7 +1599,7 @@ def test_interp_non_timedelta_index(self, interp_methods_ind, ind):
1619
1599
1620
1600
method , kwargs = interp_methods_ind
1621
1601
if method == "pchip" :
1622
- _skip_if_no_pchip ( )
1602
+ pytest . importorskip ( "scipy" )
1623
1603
1624
1604
if method == "linear" :
1625
1605
result = df [0 ].interpolate (** kwargs )
@@ -1647,7 +1627,7 @@ def test_interpolate_timedelta_index(self, interp_methods_ind):
1647
1627
1648
1628
method , kwargs = interp_methods_ind
1649
1629
if method == "pchip" :
1650
- _skip_if_no_pchip ( )
1630
+ pytest . importorskip ( "scipy" )
1651
1631
1652
1632
if method in {"linear" , "pchip" }:
1653
1633
result = df [0 ].interpolate (method = method , ** kwargs )
0 commit comments