question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

join/merge problems

See original GitHub issue

I’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']

image

retiro=kdf.loc[kdf['event_description']=='RETIRO DESDE PDT']

image

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'))

image

Using Pandas I got the expected results

Pandas DF:

pd.merge(kdf1, kdf2, on='transport_order_number', how='outer')

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

3reactions
ueshincommented, Feb 22, 2021

@FJLD The fix has been merged. It will be available in the next release. Thanks again for the report!

2reactions
ueshincommented, Feb 19, 2021

Ah, I see what you mean! Yeah, that’s right, it’s weird… Let us investigate it. Thanks for the report!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found