Todd Mercer

An identifier is a label, even when it looks like a number. When importing it with pandas read_csv, set the identifier column's dtype before inference, and explicitly define which strings count as missing. String dtype alone does not preserve literal NA, NULL, or an empty field under the default missing-value policy.
For a developer moving customer or order IDs through an agent-generated export, the acceptance test is simple: compare the decoded identifier strings, row count and row order against the source, then repeat the check after export and re-import. A successful command or a plausible-looking table is not that proof.
In Aident's October 1, 2026 synthetic test, this import policy preserved every identifier with both the C and Python parsers:
Here, an empty record_id is deliberately a literal string, while an empty amount is missing. That is an example contract, not a recommendation to permit blank customer IDs. If your business contract forbids blank IDs, preserve the input first and reject blanks explicitly.
What the two fixtures showed
We ran Python 3.13.14 and pandas 2.2.3 through Aident Loadout's Code Interpreter, using tiny in-memory CSVs and no customer data. Each policy ran with both engine="c" and engine="python". Both engines produced the same counts below.
The numeric fixture contained 00123, 123, 9007199254740992, 9007199254740993, and an empty identifier. The token fixture contained NA, NULL, N/A, nan, an empty identifier, 00123, and 00123 with surrounding spaces.
Import policy | Exact numeric-fixture IDs | Exact token-fixture IDs | Whole fixture accepted? |
|---|---|---|---|
Default read_csv | 0/5 | 0/7 | No |
Default import, then astype(str) | 0/5 | 1/7 | No |
Quote every field, default import | 0/5 | 0/7 | No |
Identifier string dtype only | 4/5 | 2/7 | No |
Identifier string dtype plus explicit NA policy | 5/5 | 7/7 | Yes |
“Exact” requires an actual string equal to the decoded source field, not numeric equivalence or display formatting. Late casting happened to recreate the literal nan token in one row, but lost the other values. One coincidental match does not make the transformation reversible.
The default numeric import collapsed 00123 and 123 to the same 123.0, and the two adjacent large IDs to the same 9007199254740992.0. These are observations from the tested fixture and runtime, not a claim that every CSV is inferred as floating point.
Run the same check through an agent
If you are evaluating an agent's CSV transformation, inspect the Code Interpreter runtime and run the complete harmless fixture below before using real exports. Record the returned pandas version and both engines' results. Aident's test completed all 20 fixture-policy runs, four export/re-import checks and 15 explicit rejection controls with empty error and stderr output.
If Aident is not installed, give your agent the installation instruction Follow https://aident.ai/SETUP.md. Then ask it:
Run the complete synthetic identifier fixture through Code Interpreter. Do not upload production data or change the environment. Return the Python and pandas versions, policy results, round-trip checks and rejected controls. If a dependency is missing or a check fails, stop and report it rather than claiming preservation.
This continues the same acceptance-test job. It is not permission to connect or write to your CRM, and a catalog visit is not proof of registration, integration connection or successful execution.
Why the obvious fixes are incomplete
The read_csv dtype and missing-value contract separates the requested type from the strings interpreted as missing. Its current documentation says to combine string or object dtype with suitable NA settings when values must not be interpreted.
Casting after import is too late. Once an ID has been converted or rounded, its original leading zeros or digits are no longer in the parsed value. You need the source to reconstruct them.
Quotes describe CSV syntax, not a pandas type declaration. Quoting every field did not prevent inference in our test.
String dtype does not disable missing-value recognition. In the token fixture it preserved the two nonmissing identifiers but converted the other five to missing values.
Disabling default NA tokens changes more than the ID column. Our policy adds back the empty-string missing marker for
amountonly. Declare other columns' missing markers separately.
Do not blindly use keep_default_na=False across an existing pipeline without reviewing every column. An amount recorded as NA might need to fail validation, become missing, or remain text under a different schema. This example tests identifier fidelity and a small amount policy, not your full data model.
A complete runnable acceptance test
Prerequisites: Python with pandas installed. No filesystem input, networking or database write is required. The Python csv parser supplies the decoded-string reference using the same explicit comma-separated fixture dialect.
The reference reader rejects unexpected or duplicate columns and malformed row widths. The comparison checks exact identifier strings, count and order. It does not enforce business uniqueness: 00123 and 123 are distinct labels here. Add required/nonblank/unique constraints separately.
Expected result on the tested runtime: all_passed: true, round_trips: 4, 20 result rows and 15 rejected controls. Expected negative-policy outcomes are intentionally asserted. If your installed version behaves differently, investigate rather than weakening the checker until it passes.
The four correct-policy exports preserved the decoded ID strings and passed re-import under the same policy. Changed, missing and reversed identifier rows were rejected, as were three malformed CSV fixtures. The test does not claim that exporting the amount 12.50 preserves its original textual formatting.
Verify the consumer, not just the exporter
A CSV contains fields, not a persistent pandas schema. Your next program can infer types again. Reapply the contract at each reader, and compare at the boundary where matching or delivery actually happens.
Keep these limits explicit:
We tested pandas 2.2.3, not the version shown by today's online documentation, every release, or the pyarrow engine. A historical pyarrow leading-zero report demonstrates why engine-specific verification matters. That issue is now closed; it is not evidence that today's pyarrow integration remains broken.
Decoded identifier equality is not byte-identical file preservation. Quoting, line endings and amount formatting can change.
The fixtures use a known dialect and tiny inputs. They do not validate arbitrary encodings, delimiters, enormous files, later join behavior or hostile input.
This test deliberately preserves spaces. Stripping or normalizing identifiers is a business decision requiring an explicit contract.
It does not establish spreadsheet safety. If the next reader is a spreadsheet, apply the separate CSV formula-injection and literal-cell test too.
If you are choosing where to run it, the Code Interpreter versus AI agent sandbox guide explains the execution boundary. A passing parser fixture is useful proof for one transformation, not a security audit or a guarantee about the whole agent workflow.
Inspect the CSV test runtime, run the controls, and keep the resulting versions and contract with the export. Refresh the test when pandas, the parser engine, the source schema or receiving system changes.
Sources and method
pandas read_csv documentation, retrieved October 1, 2026, identified itself as version 3.0.6. It supports the dtype/NA explanation; observed results use pandas 2.2.3.
Python csv documentation describes the reference parser and quoting controls.
pandas issue 57666 is historical engine-specific context, not a current-release defect claim.
Aident's October 1, 2026 first-party run: Python 3.13.14 / pandas 2.2.3, two synthetic fixtures, two engines, five policies, four correct-policy round trips and 15 explicit negative controls. No production identifiers, CRM import, spreadsheet application, LLM transformation, speed comparison, private-file transfer or external write was tested.
About the author

Todd Mercer
Todd Mercer is a senior engineer with more than 10 years of experience working on social media platforms and large-scale ordering systems. He graduated from the University of Illinois Urbana-Champaign in computer science. At Aident, he covers technical issues, developer tools, and technology topics.



The one tool
for every tool
your agent needs.
Give any AI agent real capabilities in seconds. Connect 27,000+ tools once, skip the setup headache, and let your agents execute.


