-
-
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
Conversation
@@ -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() |
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
s = Series([np.nan, np.nan]) | ||
assert_series_equal(s.interpolate(method='polynomial', order=1), s) | ||
assert_series_equal(s.interpolate(**kwargs), s) |
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.
There were a few instances where part of the function required scipy
and the other part did not. I parametrized these using kwargs
to give better visibility into what is being passed / skipped, especially on machines that don't have scipy
installed
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 comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of using kwargs
for this function as noted in the subsequent comment, but it would slightly change the test given expected
is a copy of the interpolation being done without scipy
. The subsequent scipy
interpolation is still compared back to that object for equality, which may or may not be intentional
def test_spline_extrapolate(self): | ||
tm.skip_if_no_package( |
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.
As I'm adding comments I just realized that I can almost completely get rid of the tm.skip_if_no_package
function as part of this change. It's practically always used used to check scipy
(there's one check for pytables
) and could be replaced by the skip_if_no
function in the _test_decorators
module. Will clean up in next push
Codecov Report
@@ Coverage Diff @@
## master #18794 +/- ##
==========================================
- Coverage 91.63% 91.62% -0.02%
==========================================
Files 154 154
Lines 51422 51428 +6
==========================================
- Hits 47121 47120 -1
- Misses 4301 4308 +7
Continue to review full report at Codecov.
|
@jreback how would you feel if we got rid of a dedicated The test cases that use the existing function all seem to require just one and only one of those sub-packages, so we could either:
|
ok with removing extra decorators |
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.
lgtm. lmk when you are finished. (you mentioned might be changing the decorator)
@@ -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() |
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
I'm OK to have this merged as is. Not sure the juice is worth the squeeze yet in going back and getting rid of that decorator, so I'll defer for now.
|
thanks @WillAyd keep em coming! |
git diff upstream/master -u -- "*.py" | flake8 --diff