![]() |
VOOZH | about |
Pandas dt.dayofweek attribute returns the day of the week from the given DateTime Series Object. 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.dayofweek
Parameter: None
Returns: Series with integers indicating day of week
To extract the day of the week from the Pandas Series we use the dt.dayofweek attribute of the Pandas library in Python.
Let us understand it better with an example:
Use the Series.dt.dayofweek 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 dt.dayofweek 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 dt.dayofweek attribute has successfully accessed and returned the day of week in the underlying data of the given series object.