Series.dt
can be used to access series values as datetimelike and return multiple properties. Series.dt.weekday
Pandas Series.dt.weekday
returns the day of the week. The week is assumed to start on Monday, which is 0 and ends on Sunday, which is 6.
Syntax: Series.dt.weekday
Parameter: None
Returns: numpy array
Example # 1: Use the Series.dt.weekday
attribute to return the day of the week for a given datetime in the underlying data of this Series object.
|
Output:
We will now use the Series.dt.weekday
attribute to return the day of the week for a given date and time in the underlying data of this Series object .
|
Output:
As we can see from the output, the Series.dt.weekday
attribute successfully accessed and returned day of the week in the base data of this series object.
Example # 2: Use the Series.dt.weekday
attribute to return the day of the week for a given datetime in baseline data of this Series object.
< code class = "undefined spaces"> |
Output:
We will now use the Series.dt.weekday
attribute to return the day of the week for given date and time in the underlying data of this Series object.
|
Exit:
As we can see from the output, the Series.dt.weekday
successfully accessed and returned the day of the week in the underlying data of this series object.