-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Hi,
decode_cf_datetime
is slowed down because it always passes floats to pd.to_timedelta
, while pd.to_timedelta
is much faster when working on integers.
Here is a notebook that shows the differences. Working with integers is approx. one order of magnitude faster.
Hence, it would be great to automatically do the conversion from raw time value floats to integers in nanoseconds where possible (likely limited to resolutions bellow days or hours to avoid coping with different durations numbers of nanoseconds within e.g. different months).
As alternative, maybe avoid forcing the cast to floats and indicate in the docstring that the raw values should be integers to speed up the conversion.
This could possibly also be resolved in pd.to_timedelta
but I assume it will be more complicated to deal with all the edge cases there.