Reconcile the Payments Ledger Against a Processor Report in Pandas
Last updated: November 29, 2026
Quick Overview
Meta Pay's internal ledger and an external processor's settlement report should agree on every payment. In pandas, classify each payment id as matched, missing at the processor, unknown to the ledger, double settled, or amount mismatch.
Meta
November 29, 20260
0
0 solved
Meta Pay's internal ledger and an external processor's settlement report should agree on every payment. In pandas, classify each payment id as matched, missing at the processor, unknown to the ledger, double settled, or amount mismatch.
Payments data at Meta (ads billing, Meta Pay, Shops checkouts) is reconciled daily against processors, and data engineering take-homes use this to check join hygiene in pandas. The interviewer is checking outer merges with an indicator, pre-aggregation of the many side, and explicit dedupe of the ledger.
What the Interviewer Expects
- Dedupes the ledger to one row per payment id before merging
- Aggregates the processor side to one row per payment with a settlement count
- Uses an outer merge with indicator=True
- Classifies with a clear precedence order
- Uses a tolerance for float amounts
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
- How would you vectorize the classification instead of using apply?
- How would you handle currency conversions and partial refunds?
- What would you alert on, and at what thresholds?
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
ledger(payment_id, amount_usd, status) can contain duplicate rows from re-ingestion. processor(payment_id, amount_usd, settled_at) has one row per settlement attempt, so a double charge shows up a...
Approach
Merging raw tables would multiply rows wherever either side repeats. So: dedupe the ledger, aggregate the processor side (sum and count), outer merge with indicator=True, then classify with preceden...