Build an Accounts Receivable Aging Report in Pandas

Last updated: November 29, 2026

Quick Overview

Given invoice and payment tables, produce one row per customer with the open receivable balance split into current, 1-30, 31-60, 61-90 and 90+ days past due as of a given date.

EY
Data Manipulation (SQL/Python)
Data Scientist
EY
November 29, 2026
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Given invoice and payment tables, produce one row per customer with the open receivable balance split into current, 1-30, 31-60, 61-90 and 90+ days past due as of a given date.

Receivables aging feeds expected credit loss and allowance testing, which EY audit and data analytics teams recompute from client subledgers rather than accepting the client's report. The interviewer checks joins that do not duplicate rows, correct handling of partial payments and the as-of date, and clean bucketing.

What the Interviewer Expects
  • Aggregate payments per invoice before joining to avoid fan-out
  • Compute open balance and drop fully paid invoices
  • Exclude invoices issued after the as-of date
  • Bucket by days past due with clear boundary rules
  • Pivot to one row per customer with a total that ties to the open balance
Key Topics to Cover
pandas merge
groupby aggregation
pd.cut bucketing
pivot tables
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you restrict payments to those received on or before the as-of date?
  • How would you treat overpayments and unapplied cash?
  • How would you reconcile your total to the client's AR control account?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

invoices(invoice_id, customer_id, invoice_date, due_date, amount) and payments(invoice_id, paid_amount) with zero or more payments per invoice. Days past due is as_of - due_date; zero or negativ...

Approach

Sum payments per invoice, left join to invoices, compute open = amount - paid, keep positive open balances for invoices issued by the as-of date, compute days past due, bucket with pd.cut and pivo...


Submit Your Answer
Markdown supported

Related Questions