{"record":{"id":"c66d23bea4398c79","repo":"pola-rs/polars","slug":"the-dtypes-parameter-for-read-csv-has-been-ren","errorCode":null,"errorMessage":"the `dtypes` parameter for `read_csv` has been renamed to `schema_overrides`.","messagePattern":"the `dtypes` parameter for `read_csv` has been renamed to `schema_overrides`\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/spreadsheet/functions.py","lineNumber":930,"sourceCode":"    drop_empty_cols: bool,\n    raise_if_empty: bool,\n) -> pl.DataFrame:\n    \"\"\"Translate StringIO buffer containing delimited data as a DataFrame.\"\"\"\n    # handle (completely) empty sheet data\n    if csv.tell() == 0:\n        return _empty_frame(raise_if_empty)\n\n    # otherwise rewind the buffer and parse as csv\n    csv.seek(0)\n\n    if read_options is None:\n        read_options = {}\n\n    date_cols = []\n    if schema_overrides:\n        if csv_dtypes := read_options.get(\"dtypes\", {}):\n            msg = \"the `dtypes` parameter for `read_csv` has been renamed to `schema_overrides`.\"\n            raise TypeError(msg)\n\n        csv_schema_overrides = cast(\n            \"SchemaDict\", read_options.get(\"schema_overrides\", csv_dtypes)\n        )\n        if set(csv_schema_overrides).intersection(schema_overrides):\n            msg = \"cannot specify columns in both `schema_overrides` and `read_options['dtypes']`\"\n            raise ParameterCollisionError(msg)\n\n        overrides, schema_overrides = {**csv_schema_overrides, **schema_overrides}, {}\n        for nm, dtype in overrides.items():\n            if dtype != Date:\n                schema_overrides[nm] = dtype\n            else:\n                date_cols.append(nm)\n\n        read_options = read_options.copy()\n        read_options[\"schema_overrides\"] = schema_overrides\n","sourceCodeStart":912,"sourceCodeEnd":948,"githubUrl":"https://github.com/pola-rs/polars/blob/5d8ebabf11caea54a5c29178a64a058762f49766/py-polars/src/polars/io/spreadsheet/functions.py#L912-L948","documentation":"TypeError raised in polars' spreadsheet (Excel) reading path when read_options passed to read_excel still contains the legacy 'dtypes' key. That key was renamed to 'schema_overrides' in the embedded read_csv options, so its presence signals pre-migration code and is rejected with instructions.","triggerScenarios":"pl.read_excel('f.xlsx', read_options={'dtypes': {...}}) — passing old-style read_csv options through the xlsx2csv bridge (the _csv_buffer_to_frame path).","commonSituations":"Upgrading code that previously tuned CSV dtypes when reading Excel; copy-pasting read_csv option dicts into read_excel read_options.","solutions":["Rename the key: read_options={'schema_overrides': {...}}","Prefer the top-level schema_overrides parameter of read_excel itself","Remove any leftover 'dtypes' entries when merging option dicts"],"exampleFix":"# before\npl.read_excel('f.xlsx', read_options={'dtypes': {'a': pl.Int64}})\n# after\npl.read_excel('f.xlsx', read_options={'schema_overrides': {'a': pl.Int64}})","handlingStrategy":"validation","validationCode":"if 'dtypes' in read_options:\n    read_options['schema_overrides'] = read_options.pop('dtypes')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Rename read_options['dtypes'] to ['schema_overrides']","Prefer top-level schema_overrides of read_excel","Purge legacy option dicts during migrations"],"tags":["python","polars","excel","read-csv","migration"],"backgroundTag":"removed-parameter","analyzedSha":"5d8ebabf11caea54a5c29178a64a058762f49766","analyzedAt":"2026-08-28T18:02:35.179Z","contentChangedAt":"2026-08-28T18:02:35.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}