I'm trying to convert a datetime type column into day of week with the code below:
date = {'Date': ['2018-10-30', '2018-10-30', '2018-10-30', '2018-10-30', '2018-10-30']}
df = pd.DataFrame(date)
df.Date = df.to_datetime(df.Date)
df.Date.dayofweek()
But its runnig this error: AttributeError: 'Series' object has no attribute 'dayofweek'. Why is it calling Series object if it's datetime ?
When I slice the column like this:
[In] df.Date[0].dayofweek()
[Out] 1
I get the expected result. Does anyone know what is happening?