I have a dictionary, with 100 key, each key having 500 values.
{'apple': [0.0, 0.0, 0.0, 0.2, 0.1....],'pears: [0.6, 0.2, 0.0, 0.2, 0.1....]....'oranges: [0.2, 0.1, 0.0, 0.1, 0.1.....]}
I want to smooth over the values, specifically using the hanning methodology, so that it produces smooth lines when plotted in pandas? Any guidance on how can I do this would be appreciate.
The basic intuition here is to use df.rolling
and specify a custom win_type
.
df.rolling(window=3, min_periods=1, win_type='hanning').sum()
apple oranges pears
0 0.0 0.0 0.0
1 0.0 0.2 0.6
2 0.0 0.1 0.2
3 0.0 0.0 0.0
4 0.2 0.1 0.2
I didn't know there was a "Hanning" window... but there is! Pretty neat...