From 3b24b654c3b4909664e216b6a7b82eb6dfaa580c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alp=20Ar=C4=B1bal?= Date: Tue, 27 Aug 2024 14:58:29 +0100 Subject: [PATCH] create empty with pl (#1789) Signed-off-by: Alp Aribal --- pandera/api/polars/model.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandera/api/polars/model.py b/pandera/api/polars/model.py index 9c7eecf40..caa345977 100644 --- a/pandera/api/polars/model.py +++ b/pandera/api/polars/model.py @@ -122,9 +122,9 @@ def to_json_schema(cls): FastAPI integration. """ schema = cls.to_schema() - empty = pd.DataFrame(columns=schema.columns.keys()).astype( - {k: v.type for k, v in schema.dtypes.items()} - ) + empty = pl.DataFrame( + schema={k: v.type for k, v in schema.dtypes.items()} + ).to_pandas() table_schema = pd.io.json.build_table_schema(empty) def _field_json_schema(field):