Skip to content

Conversation

phofl
Copy link
Member

@phofl phofl commented Nov 26, 2020

I think if we are at this place and len(values) is 1, we want to return a scalar instead of a Series. This happens only because loc is a slice (0,1) with one MultiIndex level instead of a scalar.

Should I create a file to move all MultiIndex at tests to the MultiIndex folder?

@jreback jreback added the Indexing Related to indexing on series/frames, not to indexes themselves label Nov 26, 2020
assert series.loc[1, 3] == 6


def test_at_get_multiindex_one_level():
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 rename to
test_multiindex_at_get_one_level

do we have similar tests? can you co-locate

Copy link
Member Author

Choose a reason for hiding this comment

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

In the same file above and test_at. One in test_partial, but this one is checking different things

Renamed the test

@jreback jreback added this to the 1.2 milestone Nov 26, 2020
@jreback
Copy link
Contributor

jreback commented Nov 28, 2020

hmm, lots of things are failing, can you merge master and ping on green.

@phofl
Copy link
Member Author

phofl commented Nov 28, 2020

Good test, caught a bug. Adjusted the code.

@phofl
Copy link
Member Author

phofl commented Nov 28, 2020

@jreback green now

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

jreback commented Nov 29, 2020

thanks @phofl

@phofl phofl deleted the 38053 branch November 29, 2020 16:04
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: calling at[] on a Series with a single-level MultiIndex returns a Series, not a scalar
2 participants