I have a list of events (A, B, C) in a dataframe and two dates for each event and I need to split those dates within their respective months.
Example:
data = {'Name': ['A', 'B', 'C'], 'Start_time': ['2017-12-15', '2017-12-15', '2017-12-15'], 'End_time': ['2018-01-17', '2017-12-22', '2018-05-22']}
df = pd.DataFrame(data)
| Events | Start_date | End_date | 
|---|---|---|
| A | 2017-12-15 | 2018-01-17 | 
| B | 2017-12-15 | 2017-12-22 | 
| C | 2017-12-15 | 2018-05-22 | 
Expected results:
| Events | Start_date | End_date | 
|---|---|---|
| A | 2017-12-15 | 2017-12-31 | 
| A | 2018-01-01 | 2018-01-17 | 
| B | 2017-12-15 | 2017-12-22 | 
| C | 2017-12-15 | 2017-12-31 | 
| C | 2018-01-01 | 2018-01-31 | 
| C | 2018-02-01 | 2018-02-28 | 
| C | 2018-03-01 | 2018-03-31 | 
| C | 2018-04-01 | 2018-04-30 | 
| C | 2018-05-01 | 2018-05-22 | 
