mattools.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:finance_news_analysis 作者: pskun 项目源码 文件源码
def get_array_ma(ts, periods):
    ma = np.empty(shape = len(ts))
    ma.fill(np.NAN)
    for i in xrange(len(ts)):
        j = i - periods + 1
        if j < 0:
            j = 0
        ma[i] = np.nanmean(ts[j:i+1], 0)
    return ma


# 0 for add, 1 for multiply
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号