Reconcile Legacy and Migrated Account Balances After Cloud Cutover
Last updated: November 29, 2026
Quick Overview
Given two pandas DataFrames of account balances (one extracted from a legacy mainframe system, one from the migrated cloud database), produce an exceptions report of missing, extra, duplicated, currency-mismatched and balance-mismatched accounts.
Infosys
November 29, 20260
0
0 solved
Given two pandas DataFrames of account balances (one extracted from a legacy mainframe system, one from the migrated cloud database), produce an exceptions report of missing, extra, duplicated, currency-mismatched and balance-mismatched accounts.
Migrations delivered under Infosys Cobalt need sign-off evidence that every record moved correctly, and reconciliation reports are a standard deliverable for the client. A take-home like this checks join semantics, key normalization, tolerance handling, and whether the output is something an auditor can read.
What the Interviewer Expects
- Normalize keys before joining (whitespace, leading zeros from fixed-width extracts)
- Use an outer join with an indicator to find both missing and extra rows
- Flag duplicates explicitly instead of letting them inflate the join
- Compare balances with a stated tolerance and only within the same currency
- Return one tidy exceptions table with an issue column
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- The extracts have 200 million rows each. How would you run this without a single machine's memory?
- How would you reconcile at an aggregate level first (counts and sums per branch) to localize problems quickly?
- Why might a tolerance be wrong for balances, and when is it acceptable?
- How would you make this report repeatable for each migration wave?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
Each frame has account_id, balance, currency. Legacy IDs come from fixed-width files and may be zero padded, so 00101 and 101 are the same account. Ask whether a balance difference under one...
Approach
Normalize IDs, flag duplicates on each side, then keep one row per key for the comparison. Outer merge with indicator=True: left_only is missing in target, right_only is extra. For matched rows,...