i trying create rolling ewma following decay= 1-ln(2)/3 on last 13 values of df such has :
factor out[36]: ewma 0 0.043 1 0.056 2 0.072 3 0.094 4 0.122 5 0.159 6 0.207 7 0.269 8 0.350 9 0.455 10 0.591 11 0.769 12 1.000
i have df of monthly returns :
change.tail(5) out[41]: date 2016-04-30 0.033 0.031 0.010 0.007 0.014 -0.006 -0.001 0.035 -0.004 0.020 0.011 0.003 2016-05-31 0.024 0.007 0.017 0.022 -0.012 0.034 0.019 0.001 0.006 0.032 -0.002 0.015 2016-06-30 -0.027 -0.004 -0.060 -0.057 -0.001 -0.096 -0.027 -0.096 -0.034 -0.024 0.044 0.001 2016-07-31 0.063 0.036 0.048 0.068 0.053 0.064 0.032 0.052 0.048 0.013 0.034 0.036 2016-08-31 -0.004 0.012 -0.005 0.009 0.028 0.005 -0.002 -0.003 -0.001 0.005 0.013 0.003
i trying apply rolling ewma each columns. know pandas has ewma method can't figure out how pass right 1-ln(2)/3 factor.
help appreciated! thanks!
Comments
Post a Comment