I've created a dataframe in python using pandas. The index used is a series of timestamp of type int64. However, for time series analysis, the index need to be type dates. Can somebody help me to do the conversion ?
>>> import pandas as pd
>>> import time
>>> import statsmodels.api as sm
>>> df = pd.DataFrame(columns=['TCA', 'TCB', 'TCC'])
>>> df.loc[int(time.time() * 1000)] = [1, 2, 3]
>>> df.index
Int64Index([1453299087814], dtype='int64')
>>> arma_mod21 = sm.tsa.ARMA(df['TCA'], (2, 1)).fit()
Traceback (most recent call last):
File "", line 1, in
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-macosx-10.6-intel.egg/statsmodels/tsa/arima_model.py", line 445, in __init__
super(ARMA, self).__init__(endog, exog, dates, freq, missing=missing)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-macosx-10.6-intel.egg/statsmodels/tsa/base/tsa_model.py", line 42, in __init__
self._init_dates(dates, freq)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-macosx-10.6-intel.egg/statsmodels/tsa/base/tsa_model.py", line 51, in _init_dates
raise ValueError("Given a pandas object and the index does "
ValueError: Given a pandas object and the index does not contain dates