Skip to content

Commit 2e78ed5

Browse files
committed
coererce some fields to strings
Signed-off-by: John Seekins <john@robot-house.us>
1 parent 76be375 commit 2e78ed5

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

utils.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@ def convert_to_dataframe(d: dict) -> polars.DataFrame:
101101
"""
102102
fieldnames = [k for k in flatdata[0].keys() if k not in flatdata_filtered_keys]
103103
# https://docs.pola.rs/api/python/stable/reference/api/polars.from_dicts.html
104-
df = polars.from_dicts(flatdata, schema=fieldnames)
105-
# logger.debug("Dataframe: %s", df)
104+
df = polars.from_dicts(
105+
flatdata,
106+
schema=fieldnames,
107+
schema_overrides={
108+
"address.postal_code": polars.Utf8,
109+
"field_office.address.postal_code": polars.Utf8,
110+
},
111+
)
112+
logger.info("Dataframe schema: %s", df.schema)
106113
# logger.debug("All header fields: %s", fieldnames)
107114
return df

0 commit comments

Comments
 (0)