Skip to content

BUG: DataFrame.at with non-unique axes #33047

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 6 commits into from
Apr 15, 2020

Conversation

jbrockmendel
Copy link
Member

Closes #33041 in conjunction with #33045.

@jreback jreback added the Indexing Related to indexing on series/frames, not to indexes themselves label Mar 26, 2020
@jreback jreback added this to the 1.1 milestone Mar 26, 2020
@property
def _axes_are_unique(self) -> bool:
# Only relevant for self.ndim == 2
return self.obj.index.is_unique and self.obj.columns.is_unique
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 add this assertion explicity

Copy link
Member Author

Choose a reason for hiding this comment

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

updated+green

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

(need to discuss the desired behaviour)

@jbrockmendel
Copy link
Member Author

i think consensus on the call was to move forward with this?

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.

yes we discussed moving forward here. @jorisvandenbossche recollection correct?

@jbrockmendel
Copy link
Member Author

gentle ping

@jorisvandenbossche
Copy link
Member

i think consensus on the call was to move forward with this?

Yes, as also summarized on the issue (#33153)

def __getitem__(self, key):
if self.ndim == 2 and not self._axes_are_unique:
# GH#33041 fall back to .loc
return self.obj.loc[key]
Copy link
Member

Choose a reason for hiding this comment

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

One problem with this, though, is that it allows any kind of indexer for this case (not only scalar ones), and thus relaxing the requirements for .at

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated to address this issue

@jbrockmendel
Copy link
Member Author

gentle ping

@jorisvandenbossche jorisvandenbossche merged commit 64de8f4 into pandas-dev:master Apr 15, 2020
@jorisvandenbossche
Copy link
Member

Thanks!

(BTW, if you have 2 approvals and no others commenting/requesting changes, I think it is fine to merge yourself)

@jbrockmendel
Copy link
Member Author

BTW, if you have 2 approvals and no others commenting/requesting changes, I think it is fine to merge yourself

Good rule of thumb, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: DataFrame.at implicitly assumes unique axes
3 participants