距纪元似乎只有几秒钟。
In [20]: df = Dataframe(data['values'])In [21]: df.columns = ["date","price"]In [22]: dfOut[22]: <class 'pandas.core.frame.Dataframe'>Int64Index: 358 entries, 0 to 357Data columns (total 2 columns):date 358 non-null valuesprice 358 non-null valuesdtypes: float64(1), int64(1)In [23]: df.head()Out[23]: date price0 1349720105 12.081 1349806505 12.352 1349892905 12.153 1349979305 12.194 1350065705 12.15In [25]: df['date'] = pd.to_datetime(df['date'],unit='s')In [26]: df.head()Out[26]: date price0 2012-10-08 18:15:05 12.081 2012-10-09 18:15:05 12.352 2012-10-10 18:15:05 12.153 2012-10-11 18:15:05 12.194 2012-10-12 18:15:05 12.15In [27]: df.dtypesOut[27]: date datetime64[ns]pricefloat64dtype: object
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)