I have the column of dates called 'Activity_Period'
in this format '200507'
which means July 2005 and I want to convert it to datetime format of ('Y'-'m')
in python.
I tried to use the datetime.strp
however it shows that the input has to be a string and not a series.
df.Activity_Period=datetime.strptime(df.Activity_Period, '%Y-%m')
The following is the error I get
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-40-ac32eb324a0b> in <module>
----> 1 df.Activity_Period=datetime.strptime(df.Activity_Period, '%Y-%m')
TypeError: strptime() argument 1 must be str, not Series