read_csv, and the arguments that matter
What it is
Beyond the path: dtype declares column types, usecols limits what is read, parse_dates converts date columns, na_values names the strings that mean missing, and chunksize streams the file.
Why it matters
Declaring dtypes up front avoids the upcast-to-object problem entirely, often halves memory, and makes the load reproducible instead of dependent on what happened to be in the first rows.
In the real world: Loading a nightly export of 5 million orders: telling Pandas which columns are dates and which codes mean “missing” avoids a wrong report the next morning.
df = pd.read_csv(
"orders.csv",
usecols=["order_id", "customer_id", "total", "ordered_at"],
dtype={"order_id": "int64", "customer_id": "string"},
parse_dates=["ordered_at"],
na_values=["", "N/A", "unknown", "-1"],
)Reading the whole file to discover the schema, then reading it again with the right dtypes. On a file that barely fits in memory, the first read is the thing that fails.
Practise it: Revenue Per Customer From a Messy CSV