Skip to content
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

Improve error mesage verbosity #59900

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

KevsterAmp
Copy link
Contributor

Continued stale PR: #59649

@KevsterAmp
Copy link
Contributor Author

@rhshadrach - could you take a look at this? thanks

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

Looking good - if this isn't currently hit by tests, they should be added.

@@ -255,7 +255,9 @@ def _validate(data):
inferred_dtype = lib.infer_dtype(values, skipna=True)

if inferred_dtype not in allowed_types:
raise AttributeError("Can only use .str accessor with string values!")
raise AttributeError(
f"Can only use .str accessor with string values!, not {inferred_dtype}"
Copy link
Member

Choose a reason for hiding this comment

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

Can you remove the !, I believe it is not grammatically correct.

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

Looks good! Can you update the test test_str_attribute in tests/series/accessors/test_str_accessor.py. Right now it is checking this case, but only checks part of the message. I think we can just update that to test the full message for this.

@rhshadrach
Copy link
Member

I think this looks good, but the CI has many unrelated failures. I'd like to get those resolved before merging PRs.

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.

ENH: increase verbosity on error
2 participants