I need to classify timestamps based on the hour, for example if it is between 7 AM and 9 AM, it will be morning. I have timestamps that I take from my csv file and I need to get only hour so I can classify the number with if statements.
I will take the timestamps from date column and create a new column named hour,
df['hour'] = df.date.dt.hour
but it gives me the following error: AttributeError: Can only use .dt accessor with datetimelike values
Timestamps are like the following: 2016-03-14 17:24:55