0

I have a dataset collected for February and O would like to break it down into weeks so I can view the data on weekly basis. I have the following attributes : start_time 183412 non-null datetime64[ns] end_time 183412 non-null datetime64[ns]

What can i use to split the month into weeks and store the results in order to create a graph based on weeks??

Wejdan
  • 1
  • Please include a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) with a small sample of your data and desired output. You are telling us which columns you have in your data, but we need to better understand the actual contents (values) and how you need to transform them. Also see [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391). – AlexK Feb 28 '23 at 07:34

1 Answers1

0

You can use datetime.date(start_time).isocalendar().week to achieve that, as it is described here: How to get week number in Python?.

If you don't know whats next, here is another question very similar to yours: split date range into row weeks

sdarmofal
  • 33
  • 6