Python Forum

Full Version: Help with Data Match Theory
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
I am newer to Pandas in Python, and I have a bit of a problem in that I cannot seem to wrap my head around how to do this task:

I have 2 DataFrames
df2018 and df2019

I need to take each row in df2019 and look to see if the "idn" in df2019 matches any "idn" in df2018, if there is NO MATCH, then, i need to create a 3rd df and place the row from 2019 into the new df.

I tried this, but it leaves the new df empty..

df2018 = pd.read_excel (r'C:\Users\User\Downloads\xxx2018.xls')
df2019 = pd.read_excel (r'C:\Users\User\Downloads\xxx2019.xls')
print(df2018)
print(df2019)

df3 = df2019[df2019['idn'].isin(df2018['idn']) == False]

print(df3)
Thank you for any help..
Thank you Larz60+

I see, as per your assistance that i was close but it was a grammatical error.