I'd like to calculate an exponential moving average in a Pandas Dataframe, but instead of the decay (or span, alpha, periods, etc...) being a float, I need it to be based on the value of another column.
Expectedly, the following code returns an error:
df['cost_EMA'] = df['cost'].ewm(span=df['ema_spans']).mean()