AI Anonymous / Practical field guide / November 8, 2026

Who counted this ticket twice?

Three support tickets become five report rows when a lookup contains two records for the same account. Use a small pandas lab to catch that mistake before the report reaches an AI summary.

In this field note · 7 sections
  1. Start with three ticket IDs
  2. Tell pandas which side must be unique
  3. Separate blank keys from missing matches
  4. Review the join before you summarize
  5. A unique lookup can still be wrong
  6. Read the pandas contract
  7. Run the lab or share the field note

Suppose an AI assistant drafts a script that adds account plans to a ticket export. The script runs and produces a table with a plan column. Then someone counts the rows. Two tickets share account 001, and the account table has both a Standard and a Premium record for 001. Each ticket matches both records. The join has already inflated the count by the time a person or model reads it.

What we ran. Eight checks against fictional data with pandas 3.1.1 and CPython 3.13.15 on Windows. The lab runs offline after installation. We made no model calls and measured no performance.
Poster reading “Who counted this ticket twice?” A black line branches upward from one paper ticket into two identical copies with orange corners. The kicker reads AI Anonymous and the footer reads JABSYSTEMS.IO.
Original AI-generated illustration of one input ticket becoming two joined rows.

01 / Reproduce

Start with three ticket IDs

Extract the practice ZIP and open PowerShell in the extracted folder. Use Python 3.13 to match the lab. The installation step downloads pandas and its dependencies. The two scripts then run locally using the supplied CSVs.

python -m venv .venv
.\.venv\Scripts\python.exe -m pip install pandas==3.1.1
.\.venv\Scripts\python.exe .\merge_lab.py
.\.venv\Scripts\python.exe .\verify_lab.py
  1. Run the unchecked left join. Tickets T-101 and T-102 each match two records. T-103 has no match and still appears once. The join returns five rows with three distinct ticket IDs.
  2. Run the audited join on the same inputs. Pandas raises MergeError for the repeated account key. The lab catches that expected exception and records it in the output.
  3. Use the separate clean account fixture. The join returns three rows. The first two tickets are marked both and T-103 is marked left_only. The lab prints its ticket ID for review.

Compare the output with observed-results.json. The two account fixtures represent the original export and a correction from its fictional owner. The script leaves the choice between Standard and Premium to that owner.

02 / Understand

Tell pandas which side must be unique

Each row on the left represents a ticket. Several tickets can belong to one account. Each row on the right should represent one account. Set validate="many_to_one" to require unique account keys on that side. The lookup_status indicator shows whether the key appeared in both inputs or only in the ticket export. See the pandas merge API.

Save this shorter example as quick_join.py in the extracted folder. Run it with .\.venv\Scripts\python.exe .\quick_join.py. It prints one line, T-103. Change the account filename to accounts-duplicate.csv and run it again to see the exception.

import pandas as pd

options = {"dtype": "string", "keep_default_na": False}
tickets = pd.read_csv("tickets.csv", **options)
accounts = pd.read_csv("accounts-clean.csv", **options)

for table in (tickets, accounts):
    ids = table["account_id"]
    if (ids.isna() | ids.str.strip().eq("")).any():
        raise ValueError("An input has a missing or blank account ID")

joined = tickets.merge(
    accounts, how="left", on="account_id",
    validate="many_to_one", indicator="lookup_status",
)
for ticket_id in joined.loc[joined["lookup_status"] == "left_only", "ticket_id"]:
    print(ticket_id)

03 / Inspect the edges

Separate blank keys from missing matches

Account 009 is a usable key with no lookup record, so its ticket goes to review. A blank account ID has no key to look up, so the example rejects the input. Pandas can match a null key to another null key, even with many_to_one if the lookup has only one null key. The eight-case check reproduces that behavior.

These fixtures read IDs as text to retain leading zeroes, and turn off the default missing-value strings so a value such as NA stays text. The blank-key check also catches whitespace-only IDs. If your export uses a marker such as NULL for missing IDs, set that policy explicitly. See the CSV parser options.

04 / Make it your own

Review the join before you summarize

  1. Write down what one row represents on each side. If the lookup contains account history, work out which record should apply to each ticket date before choosing the key.
  2. On a disposable sample, add a duplicate lookup key and a ticket with an unknown account. Run both cases. The first should stop the join. The second should leave a reviewable row.
  3. In an AI-assisted workflow, ask the assistant to state the row-count rule and show the unmatched count before drafting prose. Run the checks yourself and decide whether to pause when unmatched rows remain. The kit includes an optional review prompt.

Boundaries

A unique lookup can still be wrong

These checks cover the supplied cases. A unique row can carry an incorrect plan, a ticket export can already contain duplicate ticket IDs, and an exact text match can reflect a bad ID assigned upstream. We used fictional CSVs and did not test a model, the optional prompt, production data, or throughput.

Primary sources / Checked November 8, 2026

Read the pandas contract

Downloads / Practice files

Run the lab or share the field note

Explore more AI Anonymous field notes →

Share this post.

Found this useful? Pass it along. Download the artwork, add your own take, and tag @jabsystems.io so I can see your post.