I have a DataFrame as such:
ID Departuredate Arrivaldate
000afb96ded6677c 2014-02-08 2014-09-08
2015-10-22 2015-10-26
2017-02-19 2017-02-26
..
ffea14e87a4e1269 2020-02-18 2020-02-23
2020-07-18 2020-07-23
I need to find the date difference from each trip with the previous trip from that specific id and put into column next to it like this:
ID Departuredate Arrivaldate Time_Difference_Between_Trips
000afb96ded6677c 2014-02-08 2014-09-08 0 (days) # 0 days because there is no previous trip
2015-10-22 2015-10-26 X (days) # 2015-10-22 - 2014-09-08
2017-02-19 2017-02-26 X (days) # 2017-02-19 - 2015-10-26
..
ffea14e87a4e1269 2020-02-18 2020-02-23 X (days) # 0 days because there is no previous trip
2020-07-18 2020-07-23 X (days) # 2020-07-18 - 2020-02-23