Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BUG: raise error when converting NaT to int #62479

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
Alvaro-Kothe wants to merge 1 commit into pandas-dev:main
base: main
Choose a base branch
Loading
from Alvaro-Kothe:fix/datetime-nat

Conversation

Copy link
Contributor

@Alvaro-Kothe Alvaro-Kothe commented Sep 27, 2025


I had to branch out between finite and NA-only in check_to_int_nansafe because of this error:

E TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

Infinite values in datetime-like types when casting to int raises other errors, for example:

  • overflow: when the series contains only the inf.
  • TypeError: when the series contains inf and another value.

Previously, it was converting it to -2^63.
Copy link
Member

It is t clear this is what we want to do. There was discussion about allowing int casting at all.

Copy link
Contributor Author

Alvaro-Kothe commented Sep 27, 2025
edited
Loading

It is t clear this is what we want to do.

Ok, let me know if this should be closed.

There was discussion about allowing int casting at all.

Do you have the issue/PR number for the record?

Copy link
Member

not off the top of my head. i suspect it was opened by joris

Copy link
Contributor Author

@jbrockmendel please, confirm if it's this one: #45588

Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

BUG: converting null timedelta to int with astype() changes NaT to -9223372036854775808

AltStyle によって変換されたページ (->オリジナル) /