diff --git a/pandera/api/polars/model.py b/pandera/api/polars/model.py index 9c7eecf4..caa34597 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):