Calculate TRIP using groupby.
Cleaner calculation of start and end of line.