Skip to content

Fix regression for loc and __setitem__ when one-dimensional tuple was given for MultiIndex #37787

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

Merged
merged 8 commits into from
Nov 14, 2020

Conversation

phofl
Copy link
Member

@phofl phofl commented Nov 12, 2020

@phofl phofl added Indexing Related to indexing on series/frames, not to indexes themselves MultiIndex Regression Functionality that used to work in a prior pandas version labels Nov 12, 2020
@@ -288,6 +288,20 @@ def convert_nested_indexer(indexer_type, keys):

tm.assert_series_equal(result, expected)

def test_multiindex_loc_one_dimensional_tuple(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use frame_or_series

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@jbrockmendel
Copy link
Member

@phofl you're opening PRs faster than they can be reviewed (which is awesome, keep up the good work!). Maybe you can tackle one of the more challenging and immediate issues: the darns windows builds

@phofl
Copy link
Member Author

phofl commented Nov 12, 2020

Thank you very much @jbrockmendel Have a bit of free time this week.

Are you referring to the pipeline windows py38_no18? Unfortunately I am not that familiar with CI and even less with CI on windows.

@jreback jreback added this to the 1.1.5 milestone Nov 13, 2020
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny comment, ping on green.

@@ -288,6 +288,14 @@ def convert_nested_indexer(indexer_type, keys):

tm.assert_series_equal(result, expected)

def test_multiindex_loc_one_dimensional_tuple(self, frame_or_series):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you parameterize over all of the selectors in the OP e.g. obj.loc[('a',), :] if its a DataFrame

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added tests for df, I think one of the cases mentioned there should raise and not work

tm.assert_equal(obj, expected)

@pytest.mark.parametrize("indexer", [("a",), ("a")])
def test_multiindex_one_dimensiona_tuple_columns(self, indexer):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo dimensional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, thx. Fixed

@jreback
Copy link
Contributor

jreback commented Nov 14, 2020

lgtm ex @jbrockmendel comment, ping on green.

@jreback jreback merged commit b80691c into pandas-dev:master Nov 14, 2020
@jreback
Copy link
Contributor

jreback commented Nov 14, 2020

thanks @phofl keep em coming!

@simonjayhawkins
Copy link
Member

@meeseeksdev backport 1.1.x

@jbrockmendel
Copy link
Member

you're opening PRs faster than they can be reviewed (which is awesome, keep up the good work!). Maybe you can tackle one of the more challenging and immediate issues: the darns windows builds

Are you referring to the pipeline windows py38_no18? Unfortunately I am not that familiar with CI and even less with CI on windows.

CI is just another learning curve we all have to get up at some point. i still regularly ask for help with it.

As for windows, im not actually convinced anyone uses it ever. It might be some kind of cruel prank played by a trickster god. see #37746 where i only-half-kidding suggest we drop windows altogether.

More generally, I'm suggesting you look for areas that will have a higher ratio of (time to create PR) / (time to review PR).*

* Though im really excited about the indexing fixes you've been making.

phofl added a commit to phofl/pandas that referenced this pull request Nov 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves MultiIndex Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: errors with .loc[(slice(...), ), ] when modifying a subset of rows in a pandas dataframe/series in 1.1.4
4 participants