Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Two dataframes merged
#11
Quote:
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   
First three lines of the file.

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
Quote

Top Page

Messages In This Thread
Two dataframes merged - by Ecniv - Jun-04-2019, 06:46 PM
RE: Two dataframes merged - by chisox721 - Jun-05-2019, 06:51 PM
RE: Two dataframes merged - by Ecniv - Jun-06-2019, 06:41 PM
RE: Two dataframes merged - by chisox721 - Jun-06-2019, 07:02 PM
RE: Two dataframes merged - by Ecniv - Jun-06-2019, 08:52 PM
RE: Two dataframes merged - by chisox721 - Jun-15-2019, 08:58 PM
RE: Two dataframes merged - by Ecniv - Jun-11-2019, 07:14 PM
RE: Two dataframes merged - by Ecniv - Jun-11-2019, 08:25 PM
RE: Two dataframes merged - by Ecniv - Jun-12-2019, 08:12 PM
RE: Two dataframes merged - by Ecniv - Jun-13-2019, 06:25 PM
RE: Two dataframes merged - by Ecniv - Jun-16-2019, 09:10 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  Read exel with merged cells and write to another excel SriMekala 0 545 Aug-10-2019, 07:14 AM
Last Post: SriMekala
  how read and write merged cells in excel SriMekala 1 1,009 Aug-07-2019, 11:27 PM
Last Post: scidam
  Creating A List of DataFrames & Manipulating Columns in Each DataFrame firebird 1 236 Jul-31-2019, 04:04 AM
Last Post: scidam
  Compare between 2 DataFrames Nidhesh 2 249 Jul-26-2019, 08:16 AM
Last Post: Nidhesh
  Giving index when joining dataframes kw42chan 1 423 Jul-06-2019, 06:19 AM
Last Post: kw42chan
  Could anyone help me get the jaccard distance between my dataframes please? :) a_real_phoenix 0 456 Jun-27-2019, 06:01 PM
Last Post: a_real_phoenix
  Statistical analysis of two dataframes zhl 1 580 Jun-11-2019, 07:26 PM
Last Post: Ecniv
  Interpolate using multiple dataframes Lastwizzle 0 322 May-29-2019, 05:32 PM
Last Post: Lastwizzle
  Sum product multiple Dataframes based on column headers. Lastwizzle 0 681 May-21-2019, 04:05 PM
Last Post: Lastwizzle
  Why can't I merge pandas dataframes learnpython2018 2 1,208 Sep-23-2018, 05:53 PM
Last Post: learnpython2018

Forum Jump:


Users browsing this thread: 1 Guest(s)