Inspired by Grant Kiehne's example, this version has vectorized Z calculations and an alternate Seaborn heatmap.
Inspired by Grant Kiehne's example, this version has vectorized Z calculations and an alternate Seaborn heatmap.
In case you can't see the notebook, here's the gist of the Z calculation, along with the heatmap image.
volumes = data.iloc[:, 0:2]
means = volumes.apply(lambda x: pd.rolling_mean(x, window=MINUTES_PER_MARKET_DAY))
sds = volumes.apply(lambda x: pd.rolling_std(x, window=MINUTES_PER_MARKET_DAY))
zs = ((volumes - means) / sds)
data['z_diff'] = zs.iloc[:, 1] - zs.iloc[:, 0]
Thanks Michael,
Did you actually compare the computation times for the two approaches? Although you vectorized the z-score computation, there are still rolling computations for the means & standard deviations. So, I'm wondering if there ends up being an actual computational efficiency improvement.
Grant