{"record":{"id":"b552d2a4ef59ffca","repo":"pola-rs/polars","slug":"orient-must-be-one-of-col-row-none-go","errorCode":null,"errorMessage":"`orient` must be one of {{'col', 'row', None}}, got {orient!r}","messagePattern":"`orient` must be one of (.+?)\\}, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/_utils/construction/dataframe.py","lineNumber":638,"sourceCode":"    elif orient == \"col\":\n        column_names, schema_overrides = _unpack_schema(\n            schema, schema_overrides=schema_overrides, n_expected=len(data)\n        )\n        data_series: list[PySeries] = [\n            pl.Series(\n                column_names[i],\n                element,\n                dtype=schema_overrides.get(column_names[i]),\n                strict=strict,\n                nan_to_null=nan_to_null,\n            )._s\n            for i, element in enumerate(data)\n        ]\n        return PyDataFrame(data_series)\n\n    else:\n        msg = f\"`orient` must be one of {{'col', 'row', None}}, got {orient!r}\"\n        raise ValueError(msg)\n\n\ndef _sequence_of_series_to_pydf(\n    first_element: Series,  # noqa: ARG001\n    data: Sequence[Any],\n    schema: SchemaDefinition | None,\n    *,\n    schema_overrides: SchemaDict | None,\n    strict: bool,\n    **kwargs: Any,  # noqa: ARG001\n) -> PyDataFrame:\n    series_names = [s.name for s in data]\n    column_names, schema_overrides = _unpack_schema(\n        schema or series_names,\n        schema_overrides=schema_overrides,\n        n_expected=len(data),\n    )\n    data_series: list[PySeries] = []","sourceCodeStart":620,"sourceCodeEnd":656,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/_utils/construction/dataframe.py#L620-L656","documentation":"Raised by _sequence_of_sequence_to_pydf when the `orient` argument is not 'col', 'row', or None. Orient controls whether inner sequences are interpreted as rows or columns, and any other string is rejected with ValueError.","triggerScenarios":"pl.DataFrame([[1,2],[3,4]], orient='columns') — using a value like 'columns', 'rows', or 'auto' instead of the exact allowed strings; reached via _sequence_of_tuple_to_pydf or _sequence_of_numpy_to_pydf.","commonSituations":"Translating from pandas-style orient values such as 'index'/'columns' that polars does not accept, typos like 'cols', dynamic orient values read from config.","solutions":["Use orient='col', orient='row', or orient=None exactly","Remove the orient argument and rely on the default inference","Map legacy values before calling, e.g. {'columns':'col','index':'row'}.get(orient)"],"exampleFix":"// before\npl.DataFrame([[1, 2], [3, 4]], orient='columns')\n// after\npl.DataFrame([[1, 2], [3, 4]], orient='col')","handlingStrategy":"validation","validationCode":"assert orient in ('col', 'row', None), f'orient must be col|row|None, got {orient!r}'","typeGuard":"def valid_orient(orient: str | None) -> bool:\n    return orient in ('col', 'row', None)","tryCatchPattern":"try:\n    df = pl.DataFrame(rows, orient=orient)\nexcept ValueError as e:\n    if 'orient' in str(e) and 'must be one of' in str(e):\n        df = pl.DataFrame(rows, orient='row')\n    else:\n        raise","preventionTips":["Only use the literal strings 'col' and 'row'","Translate pandas orient vocabulary before calling polars","Keep orient values out of config, or normalize on load"],"tags":["python","polars","invalid-argument","orient"],"backgroundTag":"invalid-enum-value","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}