Skip to content

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