8000 Fixes · matplotlib/matplotlib@3d18de8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d18de8

Browse files
committed
Fixes
1 parent 51a5ab0 commit 3d18de8

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/matplotlib/dates.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,18 +252,15 @@ def _dt64_to_ordinalf(d):
252252
because we do times compared to ``0001-01-01T00:00:00`` (plus one day).
253253
"""
254254

255-
zerod = False
256-
if isinstance(d, np.datetime64):
257-
zerod = True
258-
d = np.atleast_1d(d)
255+
# the "extra" ensures that we at least allow the dynamic range out to
256+
# seconds. That should get out to +/-2e11 years.
259257
extra = d - d.astype('datetime64[s]')
260258
extra = extra.astype('timedelta64[ns]')
261259
t0 = np.datetime64('0001-01-01T00:00:00').astype('datetime64[s]')
262260
dt = (d.astype('datetime64[s]') - t0).astype(np.float64)
263261
dt += extra.astype(np.float64) / 1.0e9
264262
dt = dt / SEC_PER_DAY + 1.0
265-
if zerod:
266-
dt = dt[0]
263+
267264
return dt
268265

269266

0 commit comments

Comments
 (0)
0