Datenverschmelzung von Timeseries -Daten

def merger(df1,df2):
  return pd.merge_asof(df1,df2,on = 'Time',tolerance = pd.Timedelta(minutes = 19),direction = 'nearest')

def KeyMerger(df1,df2):
    df_1 = merger(df1,df2)
    df_2 = merger(df2,df1)
    df = pd.merge(df_1, df_2,on = 'Time', how='outer')
    df.iloc[:, 1].fillna(df.iloc[:, 4],inplace = True)
    df.iloc[:, 3].fillna(df.iloc[:, 2],inplace = True)
    df.drop(df.columns[[2,4]],axis = 1,inplace = True)
    return df
it's_flat