pola-rs/polars · error · ValueError
more dtypes overrides are specified than there are selected…
Error message
more dtypes overrides are specified than there are selected columns
What it means
Validation in read_csv: when a positional projection is combined with schema_overrides given as a list, fewer columns are being read than dtypes were supplied. The CSV reader cannot align the extra dtypes, so shorten schema_overrides or widen the projection.
Solutions
- Provide no more dtype overrides than the number of selected columns, or widen the column selection.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at py-polars/src/polars/io/csv/functions.py:437 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of pola-rs/polars@68506541d2 (2026-08-19).
Data as JSON: /api/errors/f530b0847d5618dd.
Report an issue: GitHub.
Appendix: source
Thrown at py-polars/src/polars/io/csv/functions.py:437
) as data:
import pyarrow as pa
import pyarrow.csv
try:
tbl = pa.csv.read_csv(
data,
pa.csv.ReadOptions(
skip_rows=skip_rows,
skip_rows_after_names=skip_rows_after_header,
autogenerate_column_names=not has_header,
encoding=encoding,
),
pa.csv.ParseOptions(
delimiter=separator,
quote_char=quote_char if quote_char else False,
double_quote=quote_char is not None and quote_char == '"',
),
pa.csv.ConvertOptions(
column_types=None,
include_columns=include_columns,
include_missing_columns=ignore_errors,
),
)
except pa.ArrowInvalid as err:
if raise_if_empty or "Empty CSV" not in str(err):
raise
return pl.DataFrame()
if not has_header:
# Rename 'f0', 'f1', ... columns names autogenerated by pyarrow
# to 'column_0', 'column_1', ...
tbl = tbl.rename_columns(
[f"column_{int(column[1:])}" for column in tbl.column_names]
)
elif not column_names and projection:
# User selected columns by positional index (e.g. `columns=[0, 2]`).View on GitHub (pinned to 68506541d2)