Fix serialization

This commit is contained in:
sfigato 2022-08-25 23:05:07 +02:00
parent f15c4cdcd9
commit ed9f9f4c5a
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F

View File

@ -29,6 +29,8 @@ def to_excel(data: T.List[Details]) -> bytes:
df = pd.DataFrame(data, columns=mapping) df = pd.DataFrame(data, columns=mapping)
df["status"] = df["status"].map(lambda x: x.value) df["status"] = df["status"].map(lambda x: x.value)
df.set_index("th_arrival", inplace=True) df.set_index("th_arrival", inplace=True)
df.rename(columns=mapping, inplace=True)
df = df.rename_axis(index=mapping["th_arrival"])
with NamedTemporaryFile() as tmp: with NamedTemporaryFile() as tmp:
df.to_excel(tmp) df.to_excel(tmp)