Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Create a set from two datasets with only values from df1 that isnt in df2

I have 2 dataframes.

I want to create a series with locations from df1 that arent duplicated in df2.

i am confused how to do this, any answers appreciated

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

From df_1 :

>>> df_1
    values
0   a
1   b
2   c
3   d
4   e

And df_2 :

>>> df_2
    values
0   b
1   e
2   f
3   g

We can get the values from df_1 non duplicated in df_2 using the method isin like so :

>>> df_1[~df_1['values'].isin(df_2['values'])]
    values
0   a
2   c
3   d
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading