-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TST: DataFrame.interpolate(axis='columns') throws exception while DataFrame.interpolate(axis=1) not (#25190) #31566
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
@YagoGG can you rebase |
Make sure that DataFrame.interpolate allows setting having "columns" or "index" as the axis argument.
5c0b343
to
e80d8b2
Compare
@jbrockmendel done! |
Hey @gfyoung / @jbrockmendel! Just a friendly reminder of this. Please let me know if you need further changes before merging. Thanks! |
y = np.sin(x) | ||
df = pd.DataFrame(data=np.tile(y, (10, 1)), index=np.arange(10), columns=x) | ||
df.reindex(columns=x * 1.005).interpolate(method="linear", axis="columns") | ||
df.reindex(columns=x * 1.005).interpolate(method="linear", axis="index") |
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.
@jbrockmendel : Does it make sense to also check the results?
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 that'd be worthwhile if it isnt too onerous. if nothing else, could check that we get the same result as we would if we passed the ints instead of strings.
@YagoGG o do we need the corresponding tests for Series?
@@ -983,3 +983,11 @@ def test_interp_time_inplace_axis(self, axis): | |||
result = expected.interpolate(axis=0, method="time") | |||
expected.interpolate(axis=0, method="time", inplace=True) | |||
tm.assert_frame_equal(result, expected) | |||
|
|||
def test_interp_string_axis(self): | |||
# GH 25190 |
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.
can you add a few words here so the reader doesnt need to look up 25190? very brief is OK
@YagoGG can you fix merge conflicts and address comments? |
@@ -158,6 +158,7 @@ Indexing | |||
- Bug in :meth:`PeriodIndex.is_monotonic` incorrectly returning ``True`` when containing leading ``NaT`` entries (:issue:`31437`) | |||
- Bug in :meth:`DatetimeIndex.get_loc` raising ``KeyError`` with converted-integer key instead of the user-passed key (:issue:`31425`) | |||
- Bug in :meth:`Series.xs` incorrectly returning ``Timestamp`` instead of ``datetime64`` in some object-dtype cases (:issue:`31630`) | |||
- Bug in :meth:`DataFrame.interpolate` raising ``UnboundLocalError`` when specifying the ``axis`` with a string (:issue:`25190`) |
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.
pls remove this; the bug was already fixed and this is confusing.
can you merge master and update to comments |
@YagoGG closing as stale. ping if you want to continue. |
opened a new pull request #34132, wasn't able to push here. |
Make sure that DataFrame.interpolate allows setting having "columns" or "index" as the
axis
argument.I included the
whatsnew
entry as well. However, since the bug was already fixed in v1.0.0, it might be reasonable to just drop it. I leave it to the reviewer's discretion, that's why I've put it in a separate commit.black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff