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'))
But it always gives the following error.What is the problem with the code? :(
AttributeError Traceback (most recent call last)
<ipython-input-124-9219cf10d027> in <module>()
----> 1 df.index = pd.to_datetime(df.pop('Time'))
AttributeError: 'module' object has no attribute 'to_datetime'
to_datetime
method inpd.DatetimeIndex
class. I don't use pandas before, but can't you getpd.DatetimeIndex
object fromdf.pop('Time')
? Or, maybe, convert it? – awesoon