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

BUG: OverflowError when fillna on DataFrame with a pd.Timestamp (#61208) #61212

Closed

Conversation

PedroM4rques
Copy link

@PedroM4rques PedroM4rques commented Apr 2, 2025

Fix for fillna with Out-of-Bounds Datetime Values

Issue: Using fillna on a datetime64[ns] column with an out-of-bounds timestamp (e.g., '0001-01-01') raised an AssertionError instead of the expected OutOfBoundsDatetime.

Fix: Modified the putmask method in pandas/core/internals/blocks.py to catch and re-raise OutOfBoundsDatetime directly, preventing the AssertionError.

Test Added:

  • Created test_fillna_out_of_bounds_datetime in pandas/tests/frame/methods/test_fillna.py.
  • The test:
    • Sets up a DataFrame with a datetime64[ns] column containing NaT.
    • Attempts to fill NaT with '0001-01-01'.
    • Expects OutOfBoundsDatetime.

@PedroM4rques PedroM4rques marked this pull request as draft April 2, 2025 08:33
@PedroM4rques
Copy link
Author

I did not open this PR correctly, I'll open another ASAP

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: OverflowError when fillna on DataFrame with a pd.Timestamp
1 participant