Python Forum
Help with Data Match Theory
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with Data Match Theory
#1
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..
Reply
#2
you can use Set Theory symmetric difference
https://pandas.pydata.org/pandas-docs/st...rence.html
see: https://www.kdnuggets.com/2019/11/set-op...rames.html
Reply
#3
Thank you Larz60+

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


Possibly Related Threads…
Thread Author Replies Views Last Post
  .xls processing with Pandas - my struggle moving from theory to practical use prolle 0 1,532 May-21-2020, 06:57 PM
Last Post: prolle
  Time Data does not match format AshBax 2 28,766 Nov-13-2018, 12:19 PM
Last Post: AshBax
  Match two data sets based on item values klllmmm 7 6,355 Mar-29-2017, 02:33 PM
Last Post: zivoni
  From theory to practice bertibott 12 11,875 Feb-25-2017, 12:10 AM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020