Pandas.to_datetime ERROR
I have a pandas dataframe and I want to convert the time column to datetime format. Time 30/May/2013 06:00:41 -0600 import pandas as pd df.index = pd.to_datetime(df.pop('Time'))
Solution 1:
The to_datetime
function was introduced in 0.8.0, so you'll have to upgrade your pandas to use it.
Ideally to the latest stable version.
Solution 2:
Use set_index to set the time column as the index, and then convert the Index
to DateTimeIndex
:
df = df.set_index('Time')
df.index = df.index.to_datetime()
Post a Comment for "Pandas.to_datetime ERROR"