Convert numpy.timedelta64 to float, possibly at a loss of resolution.
(array, datetime_unit)
| 717 | |
| 718 | |
| 719 | def 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 | |
| 726 | def pd_timedelta_to_float(value, datetime_unit): |
searching dependent graphs…