File: moments_ewma.py

package info (click to toggle)
pandas 0.19.2-5.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 101,196 kB
  • ctags: 83,045
  • sloc: python: 210,909; ansic: 12,582; sh: 501; makefile: 130
file content (15 lines) | stat: -rw-r--r-- 313 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import matplotlib.pyplot as plt
import pandas.util.testing as t
import pandas.stats.moments as m

t.N = 200
s = t.makeTimeSeries().cumsum()

plt.figure(figsize=(10, 5))
plt.plot(s.index, s.values)
plt.plot(s.index, m.ewma(s, 20, min_periods=1).values)
f = plt.gcf()
f.autofmt_xdate()

plt.show()
plt.close('all')