I try to create a new column with the day of the week:
df2019['Weekday']=pd.to_datetime(df2019['Year'],df2019['Month'],df2019['Day']).weekday()
And I get the following error:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Thanks!
Since your Timestamp
is already of datetime
format, you can do this:
df2019['weekday'] = df2019['Timestamp'].dt.weekday