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

Skip to content

Commit 08b5466

Browse files
QuLogictacaswell
authored andcommitted
Add datetime64 workaround for NumPy 1.10.
1 parent fc4ace6 commit 08b5466

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/dates.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ def _dt64_to_ordinalf(d):
283283

284284
# the "extra" ensures that we at least allow the dynamic range out to
285285
# seconds. That should get out to +/-2e11 years.
286-
extra = d - d.astype('datetime64[s]')
286+
# NOTE: First cast truncates; second cast back is for NumPy 1.10.
287+
extra = d - d.astype('datetime64[s]').astype(d.dtype)
287288
extra = extra.astype('timedelta64[ns]')
288289
t0 = np.datetime64('0001-01-01T00:00:00').astype('datetime64[s]')
289290
dt = (d.astype('datetime64[s]') - t0).astype(np.float64)

0 commit comments

Comments
 (0)