-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Raise when casting infinity to int #28475
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
Conversation
Haven't followed entire discussion but high level lgtm - thanks for the PR! I think @TomAugspurger can have ultimately say here though |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to agree that this is a bugfix and not an API change. I think we're safe calling it a bug.
pandas/core/indexes/numeric.py
Outdated
# TODO(jreback); this can change once we have an EA Index type | ||
# GH 13149 | ||
raise ValueError("Cannot convert NA to integer") | ||
if self.hasnans: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this re-use astype_nansafe
? That should handle things, including the nullable-integer check.
thanks @dsaxton |
black pandas
Raises a
ValueError
when attempting to cast aFloat64Index
with infinite values to a (non-ExtensionArray
) integer dtype. Currently this returns a garbage value:Related PR: #28438