How to convert a pandas DataFrame into a TimeSeries?

I know this is late to the game here but a few points.

Whether or not a DataFrame is considered a TimeSeries is the type of index. In your case, your index is already a TimeSeries, so you are good to go. For more information on all the cool slicing you can do with a the pd.timeseries index, take a look at http://pandas.pydata.org/pandas-docs/stable/timeseries.html#datetime-indexing

Now, others might arrive here because they have a column 'DateTime' that they want to make an index, in which case the answer is simple

ts = df.set_index('DateTime')

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)