0

I have a CSV file that gives data on car crashes in a particular State. One of the columns gives the specific time these crashes occurred. There are over 18,000 entries.

What I want to do is to group these timestamps as such: 00:00-03:00, 03:00-06:00, 06:00-09:00, etc. But I'm unsure of how I can first organize my column data so it groups my time stamps in such a way. Any advice?

ixixxsx
  • 43
  • 4

1 Answers1

0

So you need to split the date column into timeframes YYYY:MM:DD HH:MM:SS into only HH:MM:SS (this can be done in pandas easily). Once you have a column of time only, it can be easily grouped using group by aggregation of pandas.

May be this link shall help: How to group DataFrame by a period of time?

Chetan Kulkarni
  • 404
  • 4
  • 15