join/merge problems
See original GitHub issueI’m trying to merge 2 kdf that actually are subsets of the same kdf. The main kdf contains all the log events of the all transport_order_number : E.g.,: transport_order_number== 696530708053
kdf=ks.DataFrame({'transport_order_number': {11059585: ('696530708053'), 36538499: '696530708053', 41914814: '696530708053', 58878846: '696530708053', 83502171: '696530708053', 87335732: '696530708053', 89651819: '696530708053'},
'event_description': {11059585: 'PIEZA EN RUTA AL DESTINATARIO', 36538499: 'TRANSFERENCIA RUTA (OTBCS)', 41914814: 'RECEPCION TRANS. PIEZA', 58878846: 'RETIRO DESDE PDT', 83502171: 'RECEPCION TRANS. CONT.', 87335732: 'RECEPCIONADA', 89651819: 'PIEZA ENTREGADA A DESTINATARIO'},
'event_date': {11059585: ('2020-12-15 09:05:12.743000'), 36538499: ('2020-12-15 06:42:22.477000'), 41914814: ('2020-12-15 06:42:34.083000'), 58878846: ('2020-12-14 13:41:00'), 83502171: ('2020-12-15 06:42:00'), 87335732: ('2020-12-14 14:41:00'),
89651819: ('2020-12-15 12:53:00')}})
so I made two subset using ks.loc[]
to get just the ‘RECEPCIONADA’ AND 'RETIRO DESDE PDT ’ events with:
recepcion=kdf.loc[kdf['event_description']=='RECEPCIONADA']
retiro=kdf.loc[kdf['event_description']=='RETIRO DESDE PDT']
Then when I try to marge this 2 subset (recepcion & retiro) using ‘how=outer’ I got only NaN values …
ks.merge(fecha_recepcion, fecha_retiro, on='transport_order_number', how='outer', suffixes=('_recepcion','_retiro'))
Using Pandas I got the expected results
Pandas DF:
pd.merge(kdf1, kdf2, on='transport_order_number', how='outer')
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top Results From Across the Web
Solved: Join/Merge not working properly
Join/Merge not working properly ... The problem comes when I expand the table, and it adds all the rows again, like no join...
Read more >Join/Merge not working
Can anyone tell me why the join/merge feature will not work on my road layers? I have followed the directions in the help...
Read more >What is the difference between join and merge in Pandas?
Pandas provide various facilities for easily combining Series or DataFrame with various kinds of set logic for the indexes and relational ...
Read more >Full Outer Join- Merge two Datasets - BIRT
Hi, i use BIRT 2.3.1. I have two datasets which have a matching column, say 'account'. First dataset d1 has rows: account Budget...
Read more >Pandas Join/Merge Error: Can't join dataframes. Resulting ...
Try to check indexes in both tables with .isin construction. Maybe, it is format problem. Try to reshape it to one format with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@FJLD The fix has been merged. It will be available in the next release. Thanks again for the report!
Ah, I see what you mean! Yeah, that’s right, it’s weird… Let us investigate it. Thanks for the report!