-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Skipif no scipy #18794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skipif no scipy #18794
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
from pandas.util.testing import assert_series_equal, assert_frame_equal | ||
|
||
import pandas.util.testing as tm | ||
import pandas.util._test_decorators as td | ||
from pandas.tests.frame.common import TestData, _check_mixed_float | ||
|
||
|
||
|
@@ -646,9 +647,8 @@ def test_interp_nan_idx(self): | |
with pytest.raises(NotImplementedError): | ||
df.interpolate(method='values') | ||
|
||
@td.skip_if_no_scipy | ||
def test_interp_various(self): | ||
tm._skip_if_no_scipy() | ||
|
||
df = DataFrame({'A': [1, 2, np.nan, 4, 5, np.nan, 7], | ||
'C': [1, 2, 3, 5, 8, 13, 21]}) | ||
df = df.set_index('C') | ||
|
@@ -695,8 +695,8 @@ def test_interp_various(self): | |
expected.A.loc[13] = 5 | ||
assert_frame_equal(result, expected, check_dtype=False) | ||
|
||
@td.skip_if_no_scipy | ||
def test_interp_alt_scipy(self): | ||
tm._skip_if_no_scipy() | ||
df = DataFrame({'A': [1, 2, np.nan, 4, 5, np.nan, 7], | ||
'C': [1, 2, 3, 5, 8, 13, 21]}) | ||
result = df.interpolate(method='barycentric') | ||
|
@@ -739,8 +739,6 @@ def test_interp_rowwise(self): | |
expected[4] = expected[4].astype(np.float64) | ||
assert_frame_equal(result, expected) | ||
|
||
# scipy route | ||
tm._skip_if_no_scipy() | ||
result = df.interpolate(axis=1, method='values') | ||
assert_frame_equal(result, expected) | ||
|
||
|
@@ -753,17 +751,20 @@ def test_rowwise_alt(self): | |
1: [1, 2, 3, 4, 3, 2, 1, 0, -1]}) | ||
df.interpolate(axis=0) | ||
|
||
def test_interp_leading_nans(self): | ||
@pytest.mark.parametrize("check_scipy", [ | ||
False, pytest.param(True, marks=td.skip_if_no_scipy) | ||
]) | ||
def test_interp_leading_nans(self, check_scipy): | ||
df = DataFrame({"A": [np.nan, np.nan, .5, .25, 0], | ||
"B": [np.nan, -3, -3.5, np.nan, -4]}) | ||
result = df.interpolate() | ||
expected = df.copy() | ||
expected['B'].loc[3] = -3.75 | ||
assert_frame_equal(result, expected) | ||
|
||
tm._skip_if_no_scipy() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking of using |
||
result = df.interpolate(method='polynomial', order=1) | ||
assert_frame_equal(result, expected) | ||
if check_scipy: | ||
result = df.interpolate(method='polynomial', order=1) | ||
assert_frame_equal(result, expected) | ||
|
||
def test_interp_raise_on_only_mixed(self): | ||
df = DataFrame({'A': [1, 2, np.nan, 4], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intentionally did not replace this with a decorator because it looks unnecessary (none of the subsequent code requires spicy)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok