convolution.py 文件源码

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

项目:iota 作者: amaneureka 项目源码 文件源码
def plot_bitcoin():
    nrows = 1625
    df = pandas.read_csv('coindesk-bpi-USD-close.csv', 
                         nrows=nrows, parse_dates=[0])
    ys = df.Close.values

    window = numpy.ones(30)
    window /= sum(window)
    smoothed = numpy.convolve(ys, window, mode='valid')

    N = len(window)
    smoothed = thinkdsp.shift_right(smoothed, N//2)

    thinkplot.plot(ys, color='0.7', label='daily')
    thinkplot.plot(smoothed, label='30 day average')
    thinkplot.config(xlabel='time (days)', 
                     ylabel='price',
                     xlim=[0, nrows],
#                     ylim=[-60, 60],
                     loc='lower right')
    thinkplot.save(root='convolution1')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号