Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cf3aacf

Browse files
BUG: avoid a deprecation warning from numpy 2.5 (calling datetime64('NaT') without a unit is deprecated) (#31554)
* BUG: avoid a deprecation warning from numpy 2.5 (calling `datetime64('NaT')` without a unit is deprecated) Co-authored-by: Tim Hoffmann <[email protected]>
1 parent b39d992 commit cf3aacf

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

lib/matplotlib/dates.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,7 @@ def _dt64_to_ordinalf(d):
325325
dt += extra.astype(np.float64) / 1.0e9
326326
dt = dt / SEC_PER_DAY
327327

328-
NaT_int = np.datetime64('NaT').astype(np.int64)
329-
d_int = d.astype(np.int64)
330-
dt[d_int == NaT_int] = np.nan
328+
dt[np.isnat(d)] = np.nan
331329
return dt
332330

333331

0 commit comments

Comments
 (0)