MCPcopy Index your code
hub / github.com/pydata/xarray / np_timedelta64_to_float

Function np_timedelta64_to_float

xarray/core/duck_array_ops.py:719–723  ·  view source on GitHub ↗

Convert numpy.timedelta64 to float, possibly at a loss of resolution.

(array, datetime_unit)

Source from the content-addressed store, hash-verified

717
718
719def np_timedelta64_to_float(array, datetime_unit):
720 """Convert numpy.timedelta64 to float, possibly at a loss of resolution."""
721 unit, _ = np.datetime_data(array.dtype)
722 conversion_factor = np.timedelta64(1, unit) / np.timedelta64(1, datetime_unit)
723 return conversion_factor * array.astype(np.float64)
724
725
726def pd_timedelta_to_float(value, datetime_unit):

Callers 3

timedelta_to_numericFunction · 0.85
pd_timedelta_to_floatFunction · 0.85

Calls 1

astypeMethod · 0.45

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…