Skip to content

Adapt to deprecation of generic np.timedelta64 dtype#11281

Open
spencerkclark wants to merge 7 commits intopydata:mainfrom
spencerkclark:fix/upstream-nan-dtypes
Open

Adapt to deprecation of generic np.timedelta64 dtype#11281
spencerkclark wants to merge 7 commits intopydata:mainfrom
spencerkclark:fix/upstream-nan-dtypes

Conversation

@spencerkclark
Copy link
Copy Markdown
Member

@spencerkclark spencerkclark commented Apr 5, 2026

This PR modifies the few places we relied on a generic np.timedelta64 dtype to explicitly specify the time resolution:

  • It removes NAT_TYPES and relies instead on checking the dtype.kind in computation.nanops._maybe_null_out.
  • It infers the time unit using np.datetime_data from the input dtype to determine the unit on the returned fill_value in core.dtypes.maybe_promote.
  • It explicitly constructs a zero-valued np.timedelta64 or np.datetime64 object for use downstream in plot.utils._determine_cmap_params.

@spencerkclark spencerkclark added the run-upstream Run upstream CI label Apr 5, 2026
@spencerkclark spencerkclark force-pushed the fix/upstream-nan-dtypes branch from 6bcf381 to 6acd92f Compare April 5, 2026 15:35
@spencerkclark spencerkclark changed the title Remove NAT_TYPES and silence deprecation warning Adapt to deprecation of generic timedelta64 dtype Apr 5, 2026
@keewis
Copy link
Copy Markdown
Collaborator

keewis commented Apr 5, 2026

looks good to me. If you're up for it, the same warning is also raised in test_concat.py::test_concat_type_of_missing_fill and test_dtypes.py::test_maybe_promote[m-expected14].

@spencerkclark spencerkclark changed the title Adapt to deprecation of generic timedelta64 dtype Adapt to deprecation of generic np.timedelta64 dtype Apr 5, 2026
@spencerkclark spencerkclark force-pushed the fix/upstream-nan-dtypes branch from 124717c to 799941c Compare April 5, 2026 18:21
@spencerkclark spencerkclark force-pushed the fix/upstream-nan-dtypes branch from 4388b5e to c33f80f Compare April 5, 2026 18:46
@spencerkclark
Copy link
Copy Markdown
Member Author

Oops thanks @keewis for noting those additional related failures I missed. This should be good for another look.

@spencerkclark spencerkclark force-pushed the fix/upstream-nan-dtypes branch from c3fe02c to 624df92 Compare April 7, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants