I have a data frame consists of column 1 i.e event and column 2 is Datetime:
Sample data
Event Time
0 2020-02-12 11:00:00
0 2020-02-12 11
Use group by and agg to get the output in desired format.
df =pd.DataFrame([['0',11],['1',12],['1',13],['0',15],['1',16],['3',11]],columns=['Event','Time'] )
df.groupby(['Event']).agg(['first','last']).rename(columns={'first':'start-event','last':'end-event'})
Output:
Event start-event end-event
0 11 15
1 12 16
3 11 11