{"record":{"id":"3e04bd3c79e5bc35","repo":"pola-rs/polars","slug":"categorical-physical-must-be-one-of-pl-uint-8-16-3","errorCode":null,"errorMessage":"Categorical physical must be one of pl.UInt(8|16|32)","messagePattern":"Categorical physical must be one of pl\\.UInt\\(8\\|16\\|32\\)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/datatypes/classes.py","lineNumber":774,"sourceCode":"        physical: PolarsDataType = pldt.UInt32,\n    ) -> None:\n        if name is None or name == \"\":\n            assert namespace == \"\", \"global categories may not specify a namespace\"\n            assert physical == pldt.UInt32, (\n                \"global categories may not specify a physical type\"\n            )\n            self._categories = PyCategories.global_categories()\n            return\n\n        if physical == pldt.UInt32:\n            internal_phys = \"u32\"\n        elif physical == pldt.UInt16:\n            internal_phys = \"u16\"\n        elif physical == pldt.UInt8:\n            internal_phys = \"u8\"\n        else:\n            msg = \"Categorical physical must be one of pl.UInt(8|16|32)\"\n            raise TypeError(msg)\n\n        self._categories = PyCategories(name, namespace, internal_phys)\n\n    @staticmethod\n    def _from_py_categories(py_categories: PyCategories) -> Categories:\n        self = Categories.__new__(Categories)\n        self._categories = py_categories\n        return self\n\n    @staticmethod\n    def random(\n        namespace: str = \"\", physical: PolarsDataType = pldt.UInt32\n    ) -> Categories:\n        \"\"\"\n        Creates a new `Categories` with a random name.\n\n        Parameters\n        ----------","sourceCodeStart":756,"sourceCodeEnd":792,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/datatypes/classes.py#L756-L792","documentation":"Error \"Categorical physical must be one of pl.UInt(8|16|32)\" thrown in pola-rs/polars.","triggerScenarios":"Thrown at py-polars/src/polars/datatypes/classes.py:774 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}