Skip to content

Add more helpful error message for UnnamedIndexLevelsException - #84

Open
DeflateAwning wants to merge 2 commits into
ThibTrip:masterfrom
DeflateAwning:error_str_1
Open

Add more helpful error message for UnnamedIndexLevelsException#84
DeflateAwning wants to merge 2 commits into
ThibTrip:masterfrom
DeflateAwning:error_str_1

Conversation

@DeflateAwning

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread pangres/engine.py Outdated
index_names = list(df.index.names)
if any(ix_name is None for ix_name in index_names):
raise UnnamedIndexLevelsException("All index levels must be named!")
raise UnnamedIndexLevelsException("All index levels must be named! Ensure you used `df = df.set_index(['col1', 'col2', ...])` before.")

@ThibTrip ThibTrip Dec 3, 2023

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Hey, that looks good but the line is too long (must be <= 120 characters), so I suggest doing so:

Suggested change
raise UnnamedIndexLevelsException("All index levels must be named! Ensure you used `df = df.set_index(['col1', 'col2', ...])` before.")
raise UnnamedIndexLevelsException("All index levels must be named! "
"Ensure you used `df = df.set_index(['col1', 'col2', ...])` before.")

Comment thread pangres/utils.py Outdated
index_names = list(df.index.names)
if any([ix_name is None for ix_name in index_names]):
raise UnnamedIndexLevelsException("All index levels must be named!")
raise UnnamedIndexLevelsException("All index levels must be named! Ensure you used `df = df.set_index(['col1', 'col2', ...])` before.")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Same comment as for the other file :)

Suggested change
raise UnnamedIndexLevelsException("All index levels must be named! Ensure you used `df = df.set_index(['col1', 'col2', ...])` before.")
raise UnnamedIndexLevelsException("All index levels must be named! "
"Ensure you used `df = df.set_index(['col1', 'col2', ...])` before.")

@ThibTrip ThibTrip left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Please handle the problems I mentioned with lines being too long, then we will be good to go.

@DeflateAwning

Copy link
Copy Markdown
Contributor Author

Updated, should be good now! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants