-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
compatibility with scipy 0.19 #15689
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
Changes from 2 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 |
---|---|---|
|
@@ -548,7 +548,7 @@ def test_interp_nan_idx(self): | |
df.interpolate(method='values') | ||
|
||
def test_interp_various(self): | ||
tm.skip_if_no_package('scipy', max_version='0.19.0') | ||
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]}) | ||
|
@@ -561,8 +561,13 @@ def test_interp_various(self): | |
assert_frame_equal(result, expected) | ||
|
||
result = df.interpolate(method='cubic') | ||
expected.A.loc[3] = 2.81621174 | ||
expected.A.loc[13] = 5.64146581 | ||
import 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. you can define a variable at the very top of the file
|
||
if scipy.__version__ >= LooseVersion('0.19.0'): | ||
expected.A.loc[3] = 2.81547781 | ||
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. also can you add a comment here (1-liner), on what qualitatively changed (adding the link is ok too). imagine you are future reader and you have no idea why this was done.... |
||
expected.A.loc[13] = 5.52964175 | ||
else: | ||
expected.A.loc[3] = 2.81621174 | ||
expected.A.loc[13] = 5.64146581 | ||
assert_frame_equal(result, expected) | ||
|
||
result = df.interpolate(method='nearest') | ||
|
@@ -571,8 +576,12 @@ def test_interp_various(self): | |
assert_frame_equal(result, expected, check_dtype=False) | ||
|
||
result = df.interpolate(method='quadratic') | ||
expected.A.loc[3] = 2.82533638 | ||
expected.A.loc[13] = 6.02817974 | ||
if scipy.__version__ >= LooseVersion('0.19.0'): | ||
expected.A.loc[3] = 2.82150771 | ||
expected.A.loc[13] = 6.12648668 | ||
else: | ||
expected.A.loc[3] = 2.82533638 | ||
expected.A.loc[13] = 6.02817974 | ||
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. Generally, I'd recommend to avoid hard-coding the floating-point numbers like this: these are implementation details really. The values at round numbers should not change though. Or, at least, I'd use a relatively loose tolerance to smooth over these implementation details. 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. @ev-br point taken. Yet I think as this is the way 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. @ev-br main issue is that, somehow |
||
assert_frame_equal(result, expected) | ||
|
||
result = df.interpolate(method='slinear') | ||
|
@@ -585,10 +594,6 @@ def test_interp_various(self): | |
expected.A.loc[13] = 5 | ||
assert_frame_equal(result, expected, check_dtype=False) | ||
|
||
result = df.interpolate(method='quadratic') | ||
expected.A.loc[3] = 2.82533638 | ||
expected.A.loc[13] = 6.02817974 | ||
assert_frame_equal(result, expected) | ||
|
||
def test_interp_alt_scipy(self): | ||
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.
you don't need these comments
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.
alright. so no comment at all?
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.
yea you can take it out, unless passing the arg is meaningful?
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.
what do you mean by "meaningful"?
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.
if it were non-obvious what this parameter means / did (but passing it as
False
). So on 2nd thought if you can provide a 1-line comment on the meaning would be good.