Data from database
Print (LC4.issue_d)
1 2014-12-01 00:00:00
2 2014-12-01 00:00:00
3 2014-12-01 00:00:00
4 2014-12-01 00:00:00
5 2014-12-01 00:00:00
...
235625 2014-01-01 00:00:00
235626 2014-01-01 00:00:00
235627 2014-01-01 00:00:00
235628 2014-01-01 00:00:00
235629 2014-01-01 00:00:00
Name: issue_d, Length: 235629, dtype: object
I am trying to create an array called Month and let it be the month of the issued date; for example, for issue_d of December 1, 2014, it will return 12 to Month for the observation. The code I used:
import datetime as dt
Month = LC4.issue_d.dt.month
print (Month)
I kept getting the AttributeError: Can only use .dt accessor with datetimelike values
I am new to Python, I don't know where I got it wrong.
Thanks in advance!