Answers for "pandas merge query "_merge='left_only'""

0

pandas merge query "_merge='left_only'"

d = (
    df1.merge(df2, 
              on=['c', 'l'],
              how='left', 
              indicator=True)
    .query('_merge == "left_only"')
    .drop(columns='_merge')
)

print(d)
   c  k  l
0  A  1  a
2  B  2  a
4  C  2  d
Posted by: Guest on October-07-2020

Python Answers by Framework

Browse Popular Code Answers by Language