I have a pandas dataframe like this: start end value course
start end value course
0 2022-01-01 2022-01-01 10 first
1 2022-01-02 2022-01-02 20 first
2 2022-01-05 2022-01-05 30 second
3 2022-01-04 2022-01-04 40 second
4 2022-01-08 2022-01-08 21 first
5 2022-01-09 2022-01-09 92 first
6 2022-01-10 2022-01-10 55 first
What's the best way to group it like this:
start end value course
0 2022-01-01 2022-01-02 10 first
1 2022-01-04 2022-01-05 30 second
2 2022-01-08 2022-01-10 21 first
There might be more rows with particular course, but the idea is how to group first by the course, and second by one continuous date range? Or maybe it's worth to try to slipt by missing date? The closest case is this one, however it didn't help, since I dont have info about frequency of dates to pass into pd.Grouper(), and I also need to keep start column.