A missing quantity in a CSV is a good test for a production import. On pandas 3.0.1 the same input yields float64, Int64 or int64[pyarrow] depending on reader options. All three can print the first row as a recognizable number. A pipeline that exports integer quantities needs to check the schema as well as the value.
What Changed
Pandas 3.0 infers a dedicated str dtype for text. PyArrow supplies the storage for inferred strings when available, with a fallback when it is absent. Selecting the backend for an entire CSV import is a separate decision. dtype_backend remains a supported argument. The CSV parsing engine is another independent option. pandas migration guide · read_csv parameters
Migration Strategy
The fixture keeps a nonblank row label so the parser retains the row with the missing numeric field. Keep the default parser for all three reads. The first two cases run on a plain pandas installation. The third requires PyArrow in the same environment.
from io import StringIO
from importlib.util import find_spec
import pandas as pd
source = "label,units\nfull,1\nempty,\n"
def read_units(**options):
return pd.read_csv(StringIO(source), **options)["units"]
cases = [({}, "float64"), ({"dtype_backend": "numpy_nullable"}, "Int64")]
if find_spec("pyarrow") is not None:
cases.append(({"dtype_backend": "pyarrow"}, "int64[pyarrow]"))
for options, expected_dtype in cases:
units = read_units(**options)
assert str(units.dtype) == expected_dtype
assert units.isna().tolist() == [False, True]
assert units.iloc[0] == 1
print(pd.__version__, options, units.dtype)
If null means “quantity pending,” replacing it with zero changes the meaning of a sum or a join. Leave the null in the fixture and test any downstream fill rule separately. For an identifier such as "0001", pass an explicit text dtype when reading. Selecting a nullable backend alone will not preserve leading zeros after numeric inference.
When to Delay Migration
Run the fixture with the wheel set used by your job, then exercise its next boundary. For example, write the result to the format your warehouse accepts, read it back, and assert the schema and null mask there too. Measure input bytes, elapsed time and peak memory on representative files if an upgrade is expected to lower costs. A small CSV establishes dtype behavior and cannot predict those savings.
For changes to chained assignment, mixed indexes and older APIs, follow the 2.x to 3.0 migration checklist.
Correction, November 25, 2026. An earlier version said Arrow was the default for all columns and that dtype_backend was deprecated. The three reads above show the actual choices. The previous workload claim lacked a reproducible input.
Your notes on this article
Your name or initials, note and date stay in this browser profile. Anyone using the profile can read them. Delete a note below or clear this site’s browser data. To reach the editors, report a correction.
No notes saved here