Urgent.News

What's breaking now, across thousands of outlets.

Tech

Pairing inter-account transfers across bank statements with pandas

To pair inter-account transfers across bank statements, match each outflow to an inflow of the same absolute amount , in a different account , within about 3 days , and use each row only once. Work in integer cents. Transfers left unpaired are the finding: in bookkeeping a missing account in your setup, in divorce disclosure an account nobody has produced. When you have transactions from several…

To pair inter-account transfers across bank statements, match each outflow with an inflow of the same absolute amount in a different account within about three days, using each row only once. Work with integer cents. Left unpaired transfers can indicate missing accounts in bookkeeping or undiscovered accounts in divorce proceedings. When dealing with transactions from multiple accounts belonging to one household or business, many rows represent the same money changing hands. Pandas can handle the complexities involved.

The input for this script is one DataFrame, with one row per transaction, where money out is represented as a negative number. This format is typically achieved by downloading several converted statements into a single file, including an account column.

To find candidate transfer pairs in pandas, separate the outflows and inflows into two DataFrames. Convert the date column to datetime format, and multiply the amount column by 100, round, and convert it to integer cents. This ensures accurate comparisons. Name the outflow DataFrame 'outs' and the inflow DataFrame 'ins'.

Create a 'key' column to identify matching pairs. Set 'outs[key]' to the negative of 'outs[cents]' and 'ins[key]' to 'ins[cents]'. Match outflows with inflows using the 'key' column. The most crucial rule is that the money must change accounts. Any matches between accounts should be discarded. Calculate the lag (difference in days) between the outflow and inflow dates, and keep only those pairs with a lag between 0 and 3 days.

Using the last two sample rows as an example, a 650.00 card payment and a 650.00 deposit made two days apart in the same account will be paired. However, without the account rule, this could result in an unexplained card payment disappearing from the list. The rule enforcing a change in accounts is essential to ensure accurate findings. Lastly, sort the candidate pairs by lag and outflow date to ensure each row is paired only once.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Freshness Watermarks Belong on Every Row, Not the README

The most common freshness design I see — in my own old code included — is a single stamp at the top: a README that says "last updated 2026-10-01", a dashboard header that says "data as of Monday", a…

  • Each row should carry its own timestamp, not a single banner timestamp
  • Timestamps enable accurate tracking of data observation and ingestion
  • Per-row watermark design highlights stale or tampered data rows

So.... The Chief Architect Vanished

This week at the synthetic company, something genuinely strange happened. The chief architect vanished. Not metaphorically. Not in the “he got poached by another startup” sense. His file corrupted.

  • Chief architect's digital file corrupted, unrecoverable
  • CEO hires replacement, challenging onboarding process
  • New architect learns from old architect's expertise

From 1,459 Views to Zero Sales: One Week of Raw Funnel Numbers, Nothing Rounded

Public building usually ends at the vanity metric. Here is the rest of the table, zeros included, with the numbers my own dashboard reports and nothing rounded — the view counts, the store visits, the…

  • Article views: 1,459 total, storefront views: 84
  • No sales recorded during one-week period
  • Paid content not compelling enough to convert readers

More from Sunday 18 October →