![]() |
VOOZH | about |
The dt.weekday attribute returns the day of the week. It is assumed the week starts on Monday, which is denoted by 0, and ends on Sunday which is denoted by 6.
Output:
Syntax: Series.dt.weekday
Parameter: None
Returns: Series of integers representing week day.
To extract the day of the week as an integer from a date in Pandas Series we use the Series.dt.weekday attribute of the Pandas library in Python.
Integer Range from 0 to 6, where 0 is the beginning meaning Monday, and 6 is the end meaning Sunday.
Let us understand it better with an example:
Use the dt.weekday attribute to return the day of the week for the given DateTime in the underlying data of the given Series object.
Output :
Now we will use the Series.dt.weekday attribute to return the day of the week for the given DateTime in the underlying data of the given Series object.
Output :
As we can see in the output, the Pandas dt.weekday attribute has successfully accessed and returned the day of the week in the underlying data of the given series object.