From dda987fd5dc86851dd00a278d0bf387aa9878bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:20:59 +0000 Subject: [PATCH] fix(python): Fix typing for SchemaDefinition According to the docs you can map a column name to 'None' to let Polars infer the data type of the given column. If you use 'None', that's what happens, but typing complains because it's not expecting the value 'None', only a valid data type. --- py-polars/polars/_typing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py-polars/polars/_typing.py b/py-polars/polars/_typing.py index 67a06a2c689e..d614c1276e8f 100644 --- a/py-polars/polars/_typing.py +++ b/py-polars/polars/_typing.py @@ -72,7 +72,7 @@ def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ] SchemaDefinition: TypeAlias = Union[ - Mapping[str, Union[PolarsDataType, PythonDataType]], + Mapping[str, Union[PolarsDataType, PythonDataType, None]], Sequence[Union[str, tuple[str, Union[PolarsDataType, PythonDataType, None]]]], ] SchemaDict: TypeAlias = Mapping[str, PolarsDataType]