Skip to content

Commit 52aad44

Browse files
committed
More informative error message if no scipy
1 parent c0a5f74 commit 52aad44

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pandas/stats/moments.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,10 @@ def rolling_window(arg, window=None, win_type=None, min_periods=None,
628628
elif com.is_integer(window): #window size
629629
if win_type is None:
630630
raise ValueError('Must specify window type')
631-
import scipy.signal as sig
631+
try:
632+
import scipy.signal as sig
633+
except ImportError:
634+
raise ImportError('Please install scipy to generate window weight')
632635
win_type = _validate_win_type(win_type, kwargs) # may pop from kwargs
633636
window = sig.get_window(win_type, window).astype(float)
634637
else:

pandas/stats/tests/test_moments.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ def test_cmov_window_frame(self):
118118
assert_frame_equal(DataFrame(xp), rs)
119119

120120
def test_cmov_window_na_min_periods(self):
121+
try:
122+
from scikits.timeseries.lib import cmov_window
123+
except ImportError:
124+
raise nose.SkipTest
125+
121126
# min_periods
122127
vals = Series(np.random.randn(10))
123128
vals[4] = np.nan

0 commit comments

Comments
 (0)