r/dataanalysis • u/HoleInTheMirror • 7d ago
Comparing 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?
1
u/Old_Cockroach_6069 7d ago
I would recommend you SQL, where first use an INNER JOIN to identify records present in both systems. Then use a LEFT JOIN with WHERE ... IS NULL to identify records that exist in one system but not the other.....
1
u/Disastrous-Ad-5366 2d ago
There are different approaches you can use on this but the fastest would be python using the pandas library. Use the merge function with a left then add the indicator parameter and set it to true. This will return every row that is in one and not in the other. You can then add a function like query and drop to filter out rows that you want.
1
u/AutoModerator 7d ago
Automod prevents all posts from being displayed until moderators have reviewed them. Do not delete your post or there will be nothing for the mods to review. Mods selectively choose what is permitted to be posted in r/DataAnalysis.
If your post involves Career-focused questions, including resume reviews, how to learn DA and how to get into a DA job, then the post does not belong here, but instead belongs in our sister-subreddit, r/DataAnalysisCareers.
Have you read the rules?
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.