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
weekday_name attribute return the name of the day of the week for the given date in the Timestamp object. Example #1: Use Timestamp. weekday_name attribute to find the name of the weekday for the given date in the Timestamp object.
Use the weekday() Method to Get the Name of the Day in Python. In Python, weekday() can be used to retrieve the day of the week. The datetime. today() method returns the current date, and the weekday() method returns the day of the week as an integer where Monday is indexed as 0 and Sunday is 6.
Maybe you can use day_name:
df['Date'].dt.day_name()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With