Making a custom window type for pandas rolling mean

前端 未结 1 1465
南笙
南笙 2021-01-14 14:10

I understand rolling allows you to specify the window type used for calculating the rolling mean. The docs list a variety of windows type options available here. However, I

相关标签:
1条回答
  • 2021-01-14 15:08

    Create a kernel like this:

    import numpy as np
    kernel = np.array([1,2,2,1])/6
    

    then convolve with your series:

    np.convolve(rs,kernel,'same')
    
    0 讨论(0)
提交回复
热议问题