pola-rs/polars · error · ValueError
`orient` must be one of {{'col', 'row', None}}, got {orient!
Error message
`orient` must be one of {{'col', 'row', None}}, got {orient!r} What it means
ValueError raised in the numpy-array construction path for DataFrames: the orient argument fell through the recognized branches ('col', 'row', None interpretation) and hit the terminal else. It is a sentinel guard reporting the unrecognized orient value so callers fix the orientation hint.
Source
Thrown at py-polars/src/polars/_utils/construction/dataframe.py:638
elif orient == "col":
column_names, schema_overrides = _unpack_schema(
schema, schema_overrides=schema_overrides, n_expected=len(data)
)
data_series: list[PySeries] = [
pl.Series(
column_names[i],
element,
dtype=schema_overrides.get(column_names[i]),
strict=strict,
nan_to_null=nan_to_null,
)._s
for i, element in enumerate(data)
]
return PyDataFrame(data_series)
else:
msg = f"`orient` must be one of {{'col', 'row', None}}, got {orient!r}"
raise ValueError(msg)
def _sequence_of_series_to_pydf(
first_element: Series, # noqa: ARG001
data: Sequence[Any],
schema: SchemaDefinition | None,
*,
schema_overrides: SchemaDict | None,
strict: bool,
**kwargs: Any, # noqa: ARG001
) -> PyDataFrame:
series_names = [s.name for s in data]
column_names, schema_overrides = _unpack_schema(
schema or series_names,
schema_overrides=schema_overrides,
n_expected=len(data),
)
data_series: list[PySeries] = []View on GitHub (pinned to 68506541d2)
Solutions
- Use orient='col', orient='row', or leave it as None.
Example fix
pl.DataFrame(data, orient='row')
Defensive patterns
Strategy: validation
When it happens
Trigger: Invalid orient argument to the DataFrame constructor.
Common situations: See trigger scenarios.
AI-assisted analysis of pola-rs/polars@68506541d2 (2026-08-19).
Data as JSON: /api/errors/b552d2a4ef59ffca.
Report an issue: GitHub.