Premium problem133. Reconcile Two Systems

Medium Locked

system_a and system_b both have columns customer_id and balance.

Return the customers that disagree: present in only one system, or present in both with different balances. The result has columns customer_id, balance_a, balance_b and issue, where issue is "missing_in_b", "missing_in_a" or "mismatch". Sort by customer_id and renumber the index from 0.

Input

system_a =
   customer_id  balance
0            1     10.0
1            2     20.0
2            3     30.0
system_b =
   customer_id  balance
0            2     20.0
1            3     99.0
2            4     40.0

Output

   customer_id  balance_a  balance_b         issue
0            1       10.0        NaN  missing_in_b
1            3       30.0       99.0      mismatch
2            4        NaN       40.0  missing_in_a

Premium problem

This one's part of Premium. Unlock the full Pandas track plus every other premium problem on the site.

Implement solve(...)