There are a number of related questions on this (e.g. Collating timestamped events into date ranges with pandas), but none quite seem to cover this use case and I\'m struggling