I have this loop in order to calculate a value for same datetimes in a dataframe
for epoch in data_all['EPOCH'].unique():
data_epoch = data_all.query('EPOCH==@epoch')
data_epoch['SIGMA'] = pd.to_numeric(data_epoch['SIGMA'].values)
variance = np.mean(data_epoch['SIGMA'].values ** 2)
But that is very slow. Could you one way to do that faster?
Thank you