To get the day of the week as a number (where Monday is represented as 0 and Sunday as 6) from a datetime
object in pandas, you can use the dt.weekday
property. Here's an example:
main.py168 chars10 lines
Output:
main.py2 chars2 lines
In this example, the weekday()
function returns the day of the week as a number, where Saturday is represented as 5.
Alternatively, you can use the dt.dayofweek
property to achieve the same result.
gistlibby LogSnag