-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Allow passing other arguments to interpolation functions #10383
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
Conversation
can you add some tests? |
@@ -1734,7 +1735,7 @@ def _interpolate_scipy_wrapper(x, y, new_x, method, fill_value=None, | |||
bounds_error=bounds_error) |
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.
Should pass **kwargs
, or only support UnivariateSpline
? (Also 1749th line)
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.
It should support more types. I only wrote one so far.
Pls update docstring in |
Okay. I added tests and updated the docstring. In looking more closely I'm actually not sure what other interpolating methods should be passed the kwargs. Potentially |
@@ -2896,6 +2896,7 @@ def interpolate(self, method='linear', axis=0, limit=None, inplace=False, | |||
Update the NDFrame in place if possible. | |||
downcast : optional, 'infer' or None, defaults to None | |||
Downcast dtypes if possible. | |||
kwargs : a dictionary of keyword arguments passed into interpolating function. |
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.
This shouldn't be a dictionary I think?
So just "Other keyword arguments are passed to the interpolating function"?
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.
Updated.
Anything else to get this merged? And wow, travis-ci is SLOW at running these tests. |
see here: http://pandas.pydata.org/pandas-docs/stable/contributing.html pls squash. and travis seems quite chipper lately. We have a quite complicated setup, so takes a bit. |
Ok, I'll update the docs and then squash. I usually wait until code is 👍 before squashing to make reviewing easier. |
@@ -1365,6 +1365,23 @@ def test_spline(self): | |||
expected = Series([1., 2., 3., 4., 5., 6., 7.]) | |||
assert_series_equal(result, expected) | |||
|
|||
def test_spline_extrapolate(self): | |||
tm.skip_if_no_package('scipy', '0.15', 'setting ext on scipy.interpolate.UnivariateSpline') | |||
s = Series([1, 2, 3, 4, np.nan, 6, np.nan]) |
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.
any other methods take args?
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 talked about this here: #10383 (comment), I can add kwargs
to piecewise_polynomial_interpolate
but I am not sure how to test that method.
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, why don't you just run it, so will be a smoke test (which asserts that it didn't crash)
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 actually can't get that method to run without the exception I link to in that comment. There seems to be no current test coverage in Pandas of this method.
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.
ahh I see. hmm, wonder if that has api changes in recent versions to break this somehow?
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.
LMK what you want to do about this.
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 think we can leave that for another PR (as there is an issue for this: #10365), if you don't directly know how to solve it
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 have no idea how to solve it :-)
cacb527
to
ffbc52d
Compare
Squashed and docs. |
Anything else remaining to get this merged? |
Allow passing other arguments to interpolation functions
thanks @cancan101 |
Closes #10378