-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
compatibility with scipy 0.19 #15689
Conversation
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.
minor comment
pls add a whatsnew entry (say compat with scipy 0.19.0)
those skips look fine.
pandas/core/window.py
Outdated
@@ -544,7 +544,9 @@ def _pop_args(win_type, arg_names, kwargs): | |||
return all_args | |||
|
|||
win_type = _validate_win_type(self.win_type, kwargs) | |||
return sig.get_window(win_type, window).astype(float) | |||
# GH #15662. |
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.
note that there are more skips
This ones ok
if any remain (IOW can't / not easy fix), then we should switch these to xfailing (in 0.19.0), but that's a bit more tricky. |
I've fixed 5 of them, and plan to fix 2 more.
|
@zym1010 sure np. Yeah ignore the |
@jreback function-wise, it's now fixed. I will fix the comment later. |
pandas/tests/frame/test_missing.py
Outdated
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
you can define a variable at the very top of the file
try:
import scipy
_is_scipy_ge_0190 = scipy.__version__ >= LooseVersion(....)
exept:
_is_scipy_ge_0190 = False
pandas/tests/frame/test_missing.py
Outdated
expected.A.loc[13] = 5.64146581 | ||
import scipy | ||
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 comment
The 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....
looks like just a couple of linting issues
add a whatsnew and looks good to go. |
Codecov Report
@@ Coverage Diff @@
## master #15689 +/- ##
==========================================
- Coverage 91.02% 91% -0.03%
==========================================
Files 143 143
Lines 49409 49409
==========================================
- Hits 44977 44965 -12
- Misses 4432 4444 +12
Continue to review full report at Codecov.
|
lgtm. ping on green. |
thanks @zym1010 |
hmm, seems https://travis-ci.org/pandas-dev/pandas/jobs/211720204 is showing a failure on master scipy that does not show up on 0.19.0 :< to test installing these look at |
hmm, maybe they changed it back? (it looks like its compute the < 0.19.0) one? weird |
@jreback no idea. I think for scipy 0.19, definitely it should not return the pre 0.19 result. I think it works with conda-forge version of Scipy. What's the difference between scipy 0.19 dev and that one? |
I wonder if @ev-br has any idea on this. |
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
@ev-br point taken. Yet I think as this is the way pandas
test suites work for a very long time, it should not break arbitrarily. These computation results should be pretty stable, across different architectures, etc., for a given scipy version.
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.
@ev-br main issue is that, somehow quadratic
and cubic
interpolation results revert back to pre 0.19 behavior.
Did they? That's bizzare. I can take a look --- a self-contained example would help though. |
first one (copied from #15662), the expected result of scipy 0.19, is obtained using conda-forge built Scipy. This was tested on an unpatched pandas.
Then the one @jreback just discovered (copied from last part of https://travis-ci.org/pandas-dev/pandas/jobs/211720204), is probably obtained on dev version of scipy. This is tested on a patched pandas.
Left result is always the result computed by scipy, and right result is the expected result hardcoded in test suite. |
Hmmm, can you cook up an example which just makes scipy calls? Will be easier for me to not have to navigate through the pandas codebase which I'm not familiar with. |
@jreback can you help with this? As I'm not sure how you set up your scipy environments. |
this is from defaults (numpy 1.12) channel. We are also installing 0.19.0 on conda-forge (both these match as below). The fail is from
|
Seems same for a -dev version:
|
http://travis-dev-wheels.scipy.org/ hmm these are really old for scipy! are they being uploaded? |
Ah. Might be that scipy CI only uploads dev wheels in after_success (https://github.com/scipy/scipy/blob/master/.travis.yml#L142) and the builds with numpy-dev fail for the last couple of days because of a numpy-dev regression. |
just going to remove it from that build: #15699 |
@ev-br hmm, there should be older ones though right? (well not that old). |
Indeed. scipy/scipy#7188 |
fix pandas-dev#15662 Author: Yimeng Zhang <[email protected]> Closes pandas-dev#15689 from zym1010/fix_scipy019 and squashes the following commits: 3cc6528 [Yimeng Zhang] doc and PEP8 9ed7524 [Yimeng Zhang] fix interpolation related issue with scipy 0.19 ca09705 [Yimeng Zhang] get symmetric window
fix pandas-dev#15662 Author: Yimeng Zhang <[email protected]> Closes pandas-dev#15689 from zym1010/fix_scipy019 and squashes the following commits: 3cc6528 [Yimeng Zhang] doc and PEP8 9ed7524 [Yimeng Zhang] fix interpolation related issue with scipy 0.19 ca09705 [Yimeng Zhang] get symmetric window
fix #15662