Skip to content

ENH: Clarify error message when reindexing fails (#42000) #42007

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 1 commit into from Jun 16, 2021
Merged

ENH: Clarify error message when reindexing fails (#42000) #42007

merged 1 commit into from Jun 16, 2021

Conversation

aberres
Copy link
Contributor

@aberres aberres commented Jun 14, 2021

Copy link
Member

@phofl phofl left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -3708,7 +3708,7 @@ def _validate_can_reindex(self, indexer: np.ndarray) -> None:
"""
# trying to reindex on an axis with duplicates
if not self._index_as_unique and len(indexer):
raise ValueError("cannot reindex from a duplicate axis")
raise ValueError("Cannot reindex on an axis with duplicate labels")
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 it's common practice not to use capitalization

SyntaxError: invalid syntax
IndexError: list index out of range
IndentationError: unexpected indent
IndentationError: expected an indented block

Copy link
Contributor

Choose a reason for hiding this comment

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

agree. @aberres can you update & ping on green.

@@ -3708,7 +3708,7 @@ def _validate_can_reindex(self, indexer: np.ndarray) -> None:
"""
# trying to reindex on an axis with duplicates
if not self._index_as_unique and len(indexer):
raise ValueError("cannot reindex from a duplicate axis")
raise ValueError("Cannot reindex on an axis with duplicate labels")
Copy link
Contributor

Choose a reason for hiding this comment

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

agree. @aberres can you update & ping on green.

@jreback jreback added the Error Reporting Incorrect or improved errors from pandas label Jun 15, 2021
@aberres
Copy link
Contributor Author

aberres commented Jun 16, 2021

@jreback Updated. Not green, but the failing check seems unrelated?

@simonjayhawkins
Copy link
Member

@jreback Updated. Not green, but the failing check seems unrelated?

should now be fixed

@simonjayhawkins
Copy link
Member

i'll merge with a 1.4 milestone. but a trivial change so could backport.

@simonjayhawkins simonjayhawkins added this to the 1.4 milestone Jun 16, 2021
@simonjayhawkins simonjayhawkins merged commit be41c04 into pandas-dev:master Jun 16, 2021
@simonjayhawkins
Copy link
Member

Thanks @aberres

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Clarify error message when reindexing on an axis containing duplicates
4 participants