File: moments_ewma.py

package info (click to toggle)
pandas 0.14.1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 54,924 kB
  • ctags: 53,113
  • sloc: python: 130,524; ansic: 11,510; sh: 329; makefile: 118
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')