Skip to content

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

Closed
wants to merge 2 commits into from

Conversation

YagoGG
Copy link
Contributor

@YagoGG YagoGG commented Feb 2, 2020

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.

@YagoGG YagoGG changed the title Fix/interpolate tests TST: DataFrame.interpolate(axis='columns') throws exception while DataFrame.interpolate(axis=1) not (#25190) Feb 2, 2020
@YagoGG YagoGG requested a review from gfyoung February 2, 2020 09:59
@gfyoung
Copy link
Member

gfyoung commented Feb 2, 2020

@YagoGG : Changes look good, but it seems we have some unrelated test failures just as in #31566.

@jbrockmendel
Copy link
Member

@YagoGG can you rebase

Make sure that DataFrame.interpolate allows setting having "columns" or
"index" as the axis argument.
@YagoGG YagoGG force-pushed the fix/interpolate-tests branch from 5c0b343 to e80d8b2 Compare February 11, 2020 19:13
@YagoGG
Copy link
Contributor Author

YagoGG commented Feb 11, 2020

@jbrockmendel done!

@YagoGG
Copy link
Contributor Author

YagoGG commented Feb 19, 2020

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")
Copy link
Member

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?

Copy link
Member

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
Copy link
Member

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

@WillAyd
Copy link
Member

WillAyd commented Mar 25, 2020

@YagoGG can you fix merge conflicts and address comments?

@jreback jreback added Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Testing pandas testing functions or related to the test suite labels Mar 26, 2020
@jreback jreback added this to the 1.1 milestone Mar 26, 2020
@@ -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`)
Copy link
Contributor

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.

@jreback
Copy link
Contributor

jreback commented Apr 7, 2020

can you merge master and update to comments

@simonjayhawkins
Copy link
Member

@YagoGG closing as stale. ping if you want to continue.

@simonjayhawkins
Copy link
Member

can you merge master and update to comments

opened a new pull request #34132, wasn't able to push here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DataFrame.interpolate(axis='columns') throws exception while DataFrame.interpolate(axis=1) not
6 participants