Jun-16-2019, 09:10 PM
Quote:First three lines of the file.Date Check-in Departure Check-out \ 0 04-05-2019 09:53 Ouderkerk a/d Amstel, Ouderkerk a/d Amst NaN 1 04-05-2019 NaN Ouderkerk a/d Amstel, Ouderkerk a/d Amst 10:02 2 04-05-2019 13:16 Amstelveen, Busstation NaN Destination Amount Transaction Class Product Comments Name \ 0 NaN NaN Check-in NaN NaN NaN NaN 1 Amstelveen, Busstation 1.77 Check-out NaN NaN NaN NaN 2 NaN NaN Check-in NaN NaN NaN NaN
Essentially its one line for check in (bus stop) and one for check out. Most people are only interested in the check out as that is the cost part. I wanted to get a trip/journey so I need to merge the lines. However, the check out although isnt optional, may not be there.
So my first thought was to split the file into checkin and checkout. Then re merge together. But there is no unique field to tie them together. Hence loop the check out to try and find the check in before it.
The coding above did work, I was trying to change the date checkin and date check out to a datetime field (second attempt) and something changed in the dataframe. It no longer updates via index. So I broke it...
I may repost a different question later...
Thanks for looking at this