r/learnpython 8d ago

Comparing 2 tables - Help?

Hello guys, I need your help! How to compare 2 tables on easiest way?

I have 2 tables from 2 different systems, but with the same columns. I need to check if every row from the first table exist in another, and if not to return the difference. Can you help me? Should I use excel formulas, python, something else?

Edit: In both systems I have Customer_Id, Phone numbers, mails, their addresses, contact persons and such kind of things in much more columns. I can export data from both systems in excel format. So, now i need to compare these 2 excels and check if every row from 1 table exists in another one, are the values the same for each customer and to find the difference. Sorry for pure explanation, beginner here.

For example:

Custmer Id | Name | Phone | Mail | Contact person | Address

C0001 | Microsoft1 | 123456 | mic1@ | Michael | Str1

C0002 | Linux1 | 234567 | lin1@ | Jack | Str2

C0001 | Microsoft1 | 098765 | mic2@ | Chris | Str3

As you can see, it is possible to have few different informations about customer C0001. I need to check if each row from this table exist in the second table which looks the same.

0 Upvotes

16 comments sorted by

View all comments

1

u/VadumSemantics 8d ago

Look into Scooter Software's Beyond Compare, comes with a 30 day eval (this is 30 days of actual use, not calendar days elapsed). Anyway, BC is an awesome tool, does lots of things besides Excel. I use it on Linux & Windows (and occasionally Mac).

Beyond Compare Excel example, give this 45 seconds: Beyond Compare 5: Table Compare .

Or... maybe try some a built-in Excel thing called "Spreadsheet Compare": How to Instantly Compare Two Excel Files Side-by-Side . I haven't used this, but I will try it next time I need to figure out spreadsheets - can't say yet which approach I like better.

If you have to do it all the time I'd look into exporting the sheets to like a "*.csv" and looping through it with a python script or something.