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

Fix pandas datetime decoding with NumPy >= 2.0 for small integer dtypes #9518

Merged

Conversation

spencerkclark
Copy link
Member

This PR addresses the issue that @langmore brought up in #9498 (review). Thanks again for noting this and suggesting the fix.

I modified an existing test such that it will no longer fall back to cftime, so that it fails without this fix even if cftime is installed.

  • Tests added
  • User visible changes (including notable bug fixes) are documented in whats-new.rst

Comment on lines +1454 to +1455
"mixed-cftime-pandas-encoding-with-prescribed-units-and-dtype": pytest.param(
"250YS", "days since 1700-01-01", np.dtype("int32"), marks=requires_cftime
Copy link
Member Author

Choose a reason for hiding this comment

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

Not related to this PR, but I noticed when testing in an environment without cftime that this test was not skipped. I guess we don't have a CI environment that has dask, but not cftime. I figured I would take the opportunity to clean this up.

Copy link
Member

@shoyer shoyer left a comment

Choose a reason for hiding this comment

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

Thanks Spencer! This looks great to me.

@spencerkclark spencerkclark merged commit 17571b5 into pydata:main Sep 19, 2024
28 checks passed
@spencerkclark spencerkclark deleted the work-around-to_timedelta-issue branch September 19, 2024 00:46
hollymandel pushed a commit to hollymandel/xarray that referenced this pull request Sep 23, 2024
…es (pydata#9518)

* Fix pandas datetime decoding with np.int32 values and NumPy >= 2

Thanks @langmore for noting this issue and suggesting this workaround.

* Refine what's new entry
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.

2 participants