Skip to content

Fix decimal isnumeric #1

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

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

Fix decimal isnumeric #1

wants to merge 2 commits into from

Conversation

johnattong
Copy link
Owner

@johnattong johnattong commented Feb 17, 2025

isnumeric now works to include decimal strings to be evaluated as true.

@johnattong johnattong closed this Feb 17, 2025
@johnattong johnattong reopened this Feb 17, 2025
Copy link

@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.

Thanks for the PR! But I believe all we need to do here is add to the docstring.

Comment on lines +471 to +481
def is_numeric(value):
if value.isnumeric():
return True
else:
try:
float(value) # Try converting to float (supports negative and decimals)
return True
except ValueError:
return False

return self._str_map(is_numeric, dtype="bool")

Choose a reason for hiding this comment

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

I am negative on this change. As mentioned in the issue, I do not believe we should be changing the behavior of is_numeric here.

pandas-dev#60750 (comment)
pandas-dev#60750 (comment)

Choose a reason for hiding this comment

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

I didn't realize this was a PR in your fork - apologies. However, if you do want to contribute to pandas, you need to open up a PR in the pandas repository and not your fork of it.

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.

BUG: pd.Series.isnumeric() doesn't work on decimal value strings
2 participants