0

I have two tables:

Table1:

Name Description Amount
123 Description123 123
456 Description456 456
789 Description789 666
101 Description777 101
133 Description133 133

Table2:

Name Description Amount
456 Description456 456
789 Description789 789
101 Description101 101
123 Description123 123
102 Description102 102

I need to find the difference in Table1 compare it with Table2. The connection between these 2 Excel files will be the column Name. The expected output is if something is changed in Table 2 the data must be used from Table 2 and if there are new rows from Table 2 they must be added to the final result. If nothing is also changed or Table 2 doesn't have any data for specific Name from Table 1 like 133 the rows also need to be added to the final result.

Expected output:

Name Description Amount
123 Description123 123
456 Description456 456
789 Description789 789
101 Description101 101
102 Description102 102
133 Description133 133

Thanks in advance!

Edit1: I struggle to find the solution. I understand how to compare each row in the excel files, but they need to have exactly the same order in the Name column. I don't know how to do it if there is no order like this specific case above.

csmaster
  • 579
  • 4
  • 14
greg
  • 3
  • 3
  • I struggle to find the solution. I just understand how to compare each rows in the excel files, but they need to have exactly the same order in Name column. I don't know how to do it if there is no order like this specific case above. – greg Dec 14 '21 at 14:51
  • 1
    https://pandas.pydata.org/pandas-docs/stable/user_guide/merging.html – BigBen Dec 14 '21 at 14:52
  • 1
    As BigBen linked, and [previously answered](https://stackoverflow.com/a/9794891/7891382), you will need to set_index – IamFr0ssT Dec 14 '21 at 14:57
  • @greg - it was not a rude comment. Unfortunately SO sees many low-quality questions that equate to "give me some code" please and demonstrate no attempt to solve the problem. Since this is not a code-writing service, it's best to demonstrate what you've tried, otherwise it *seems* like you're just asking for code, even if that's not your intention. See [ask] and [reprex] for further reading. – BigBen Dec 14 '21 at 15:15

0 Answers0