Fix the datetime/pandas.datetime issue with the nanos
-
datetime
(python) does not support nanos resolution. So all that info is lost when pythondatetime
object is created, need to change to pandasTimestamp()
instead - the same issue is in the ongoing MR (i.e. epicsarchiver implementation)...
- to be fixed here https://gitlab.esss.lu.se/accop/pytools/pychiver/-/blame/master/pychiver/endpoints.py#L66
import pandas as pd
from pytz import utc as UTC
def fix_time_dt(a):
return pd.Timestamp(int(a["secs"]) * int(1e9) + int(a["nanos"]), tz=UTC)
(...)
df['time_fixed'] = df.apply(lambda row : fix_time_dt(row), axis=1)
application of the above is visible in the last column (fixed manual)