I am reading multiple spreadsheets of timeseries into a pandas dataFrame and concatenating them together with a common pandas datetime index. The datalogger that logged the
For data columns; Use: round_hour(df.Start_time)
def round_hour(x,tt=''):
if tt=='M':
return pd.to_datetime(((x.astype('i8')/(1e9*60)).round()*1e9*60).astype(np.int64))
elif tt=='H':
return pd.to_datetime(((x.astype('i8')/(1e9*60*60)).round()*1e9*60*60).astype(np.int64))
else:
return pd.to_datetime(((x.astype('i8')/(1e9)).round()*1e9).astype(np.int64))