FOMO Daily
Feed
Lerner Consulting Blogยท

Pandas groupby on datetime parts with the dt accessor

Data EngineeringPandasPythonDatetime

TL;DR

To summarize data by part of a datetime column in Pandas, use the dt accessor to extract the time component and group by it. This lets you calculate aggregates such as mean trip distance for each group without grouping by full timestamps.

Read the original post Sign in to mark as read or skip