>>> dta = [44,43,18,18,45,36,87,43,45,17,17,47,42,42,43,47,17,17,45,44,44,47,46,16,16,64,42,41,40,45,15,16,47,42,42,44,41,18,16,44,44,42,44]
>>> dta = np.array(dta, dtype = np.float)
>>> dta
array([ 44., 43., 18., 18., 45., 36., 87., 43., 45., 17., 17.,
47., 42., 42., 43., 47., 17., 17., 45., 44., 44., 47.,
46., 16., 16., 64., 42., 41., 40., 45., 15., 16., 47.,
42., 42., 44., 41., 18., 16., 44., 44., 42., 44.])
>>> dta = pd.Series(dta)
>>> dta
0 44.0
1 43.0
2 18.0
3 18.0
4 45.0
5 36.0
6 87.0
7 43.0
8 45.0
9 17.0
10 17.0
11 47.0
12 42.0
13 42.0
14 43.0
15 47.0
16 17.0
17 17.0
18 45.0
19 44.0
20 44.0
21 47.0
22 46.0
23 16.0
24 16.0
25 64.0
26 42.0
27 41.0
28 40.0
29 45.0
30 15.0
31 16.0
32 47.0
33 42.0
34 42.0
35 44.0
36 41.0
37 18.0
38 16.0
39 44.0
40 44.0
41 42.0
42 44.0
dtype: float64
>>> rng = pd.date_range('6/1/2017', '7/13/2017', freq = 'D')
>>> rng
DatetimeIndex(['2017-06-01', '2017-06-02', '2017-06-03', '2017-06-04',
'2017-06-05', '2017-06-06', '2017-06-07', '2017-06-08',
'2017-06-09', '2017-06-10', '2017-06-11', '2017-06-12',
'2017-06-13', '2017-06-14', '2017-06-15', '2017-06-16',
'2017-06-17', '2017-06-18', '2017-06-19', '2017-06-20',
'2017-06-21', '2017-06-22', '2017-06-23', '2017-06-24',
'2017-06-25', '2017-06-26', '2017-06-27', '2017-06-28',
'2017-06-29', '2017-06-30', '2017-07-01', '2017-07-02',
'2017-07-03', '2017-07-04', '2017-07-05', '2017-07-06',
'2017-07-07', '2017-07-08', '2017-07-09', '2017-07-10',
'2017-07-11', '2017-07-12', '2017-07-13'],
dtype='datetime64[ns]', freq='D')
>>> rng[0]
Timestamp('2017-06-01 00:00:00', freq='D')
>>> rng.map(lambda t: t.strftime('%Y-%m-%d'))
array([u'2017-06-01', u'2017-06-02', u'2017-06-03', u'2017-06-04',
u'2017-06-05', u'2017-06-06', u'2017-06-07', u'2017-06-08',
u'2017-06-09', u'2017-06-10', u'2017-06-11', u'2017-06-12',
u'2017-06-13', u'2017-06-14', u'2017-06-15', u'2017-06-16',
u'2017-06-17', u'2017-06-18', u'2017-06-19', u'2017-06-20',
u'2017-06-21', u'2017-06-22', u'2017-06-23', u'2017-06-24',
u'2017-06-25', u'2017-06-26', u'2017-06-27', u'2017-06-28',
u'2017-06-29', u'2017-06-30', u'2017-07-01', u'2017-07-02',
u'2017-07-03', u'2017-07-04', u'2017-07-05', u'2017-07-06',
u'2017-07-07', u'2017-07-08', u'2017-07-09', u'2017-07-10',
u'2017-07-11', u'2017-07-12', u'2017-07-13'],
dtype='<U10')
>>> rng[0]
Timestamp('2017-06-01 00:00:00', freq='D')
>>> dta.index = pd.Index(rng)
>>> dta
2017-06-01 44.0
2017-06-02 43.0
2017-06-03 18.0
2017-06-04 18.0
2017-06-05 45.0
2017-06-06 36.0
2017-06-07 87.0
2017-06-08 43.0
2017-06-09 45.0
2017-06-10 17.0
2017-06-11 17.0
2017-06-12 47.0
2017-06-13 42.0
2017-06-14 42.0
2017-06-15 43.0
2017-06-16 47.0
2017-06-17 17.0
2017-06-18 17.0
2017-06-19 45.0
2017-06-20 44.0
2017-06-21 44.0
2017-06-22 47.0
2017-06-23 46.0
2017-06-24 16.0
2017-06-25 16.0
2017-06-26 64.0
2017-06-27 42.0
2017-06-28 41.0
2017-06-29 40.0
2017-06-30 45.0
2017-07-01 15.0
2017-07-02 16.0
2017-07-03 47.0
2017-07-04 42.0
2017-07-05 42.0
2017-07-06 44.0
2017-07-07 41.0
2017-07-08 18.0
2017-07-09 16.0
2017-07-10 44.0
2017-07-11 44.0
2017-07-12 42.0
2017-07-13 44.0
Freq: D, dtype: float64
>>> dta.plot(figsize = (12, 8))
<matplotlib.axes._subplots.AxesSubplot object at 0x05ACC610>
>>> plt.show()
>>> diff1 = dta.diff(1)
>>> sm.stats.durbin_watson(dta)
0.23328335832083957
>>> fig = plt.figure(figsize = (12, 8))
>>> ax1 = fig.add_subplot(211)
>>> fig = sm.graphics.tsa.plot_acf(dta.values.squeeze(),lags = 40, ax = ax1)
>>> fig.show()
import statsmodels.api as sm
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
dta = [44,43,18,18,45,36,87,43,45,17,17,47,42,42,43,47,17,17,45,44,44,47,46,16,16,64,42,41,40,45,15,16,47,42,42,44,41,18,16,44,44,42,44]
dta = np.array(dta, dtype = np.float)
dta = pd.Series(dta)
rng = pd.date_range('6/1/2017', '7/13/2017', freq = 'D')
#rng.map(lambda t: t.strftime('%Y-%m-%d'))
dta.index = pd.Index(rng)
dta.plot(figsize = (12, 8))
plt.show()
diff1 = dta.diff(1)
sm.stats.durbin_watson(dta)
fig = plt.figure(figsize = (12, 8))
ax1 = fig.add_subplot(211)
fig = sm.graphics.tsa.plot_acf(dta.values.squeeze(),lags = 40, ax = ax1)
ax2 = fig.add_subplot(212)
fig = sm.graphics.tsa.plot_pacf(dta, lags = 40, ax = ax2)
fig.show()