Skip to content

Instantly share code, notes, and snippets.

@yuyasugano
Created September 26, 2020 09:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuyasugano/9520f17a560d79062aa870fffdb07ec7 to your computer and use it in GitHub Desktop.
Save yuyasugano/9520f17a560d79062aa870fffdb07ec7 to your computer and use it in GitHub Desktop.
Pandas DataFrame tips
print(df.rolling(3, win_type='triang').sum())
num
0 NaN
1 NaN
2 2.0
3 4.0
4 6.0
5 8.0
6 10.0
7 12.0
8 14.0
9 16.0
print(df.rolling(3, win_type='exponential').sum(tau=1))
num
0 NaN
1 NaN
2 1.735759
3 3.471518
4 5.207277
5 6.943036
6 8.678794
7 10.414553
8 12.150312
9 13.886071
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment