File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -405,18 +405,19 @@ def date2num(d):
405
405
Gregorian calendar is assumed; this is not universal practice.
406
406
For details see the module docstring.
407
407
"""
408
-
409
408
if hasattr (d , "values" ):
410
409
# this unpacks pandas series or dataframes...
411
410
d = d .values
412
-
413
- if ((isinstance (d , np .ndarray ) and np .issubdtype (d .dtype , np .datetime64 ))
414
- or isinstance (d , np .datetime64 )):
415
- return _dt64_to_ordinalf (d )
416
411
if not np .iterable (d ):
412
+ if (isinstance (d , np .datetime64 ) or (isinstance (d , np .ndarray ) and
413
+ np .issubdtype (d .dtype , np .datetime64 ))):
414
+ return _dt64_to_ordinalf (d )
417
415
return _to_ordinalf (d )
416
+
418
417
else :
419
418
d = np .asarray (d )
419
+ if np .issubdtype (d .dtype , np .datetime64 ):
420
+ return _dt64_to_ordinalf (d )
420
421
if not d .size :
421
422
return d
422
423
return _to_ordinalf_np_vectorized (d )
You can’t perform that action at this time.
0 commit comments