Parts of a Date: .dt

Once a column holds dates, .dt gives its parts for every row at once, such as year, month, day_name(), hour and date, so you can count by weekday or hour, and subtracting two dates gives a Timedelta, the gap between them, whose .dt.days counts whole days.

By

Updated

Cheat sheet: Parts of a Date: .dt
Category
Data Analysis
Level
Apprentice
Tags
dt accessor, python, Timedelta, Timestamp