Weekday name from a pandas dataframe Date object

John Doe picture John Doe · Feb 21, 2020 · Viewed 7.2k times · Source

I would like to get the weekday name for all my date. I have a pandas df which has a Date column formatted to datetime64[ns]

i have tried the following

data['Date'].dt.weekday_name

and I get the response

data['Date'].dt.weekday_name
Traceback (most recent call last):

  File "<ipython-input-207-e57074c4e346>", line 1, in <module>
    data['Date'].dt.weekday_name

AttributeError: 'DatetimeProperties' object has no attribute 'weekday_name'

Please help

Answer

zipa picture zipa · Feb 21, 2020

Maybe you can use day_name:

df['Date'].dt.day_name()