calculate exponential moving average in python

后端 未结 14 2349
囚心锁ツ
囚心锁ツ 2020-12-01 00:59

I have a range of dates and a measurement on each of those dates. I\'d like to calculate an exponential moving average for each of the dates. Does anybody know how to do t

14条回答
  •  不思量自难忘°
    2020-12-01 01:44

    more simply, using pandas

    def EMA(tw):
        for x in tw:
            data["EMA{}".format(x)] = data['close'].ewm(span=x, adjust=False).mean()
            EMA([10,50,100])
    

提交回复
热议问题