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.

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.
Python Workout isn’t designed to teach you Python, although I hope and expect that you’ll learn quite a bit along the way. It is meant to help you improve your understand ing of Python and how to...
23/09/2020
Mastering regular expressions by Jeffrey Friedl, 3rd edition. Regular expressions are an extremely powerful tool for manipulating text and data. They are standard features today in a variety of pop...
05/09/2021
A Practical Approach to Computer Algorithms Using Python® and C# Rod Stephens started out as a mathematician, but while studying at MIT, he discovered how much fun algorithms are. He took every al...
23/09/2020
As information protection continues to be a growing concern for businesses today, IT security certifications have become highly desirable, even as the number of certifications has grown. Now you can s...
12/08/2021