Skip to content

Commit

Permalink
fix: 🐛 crash when exporting timezoned timestamp data to excel
Browse files Browse the repository at this point in the history
  • Loading branch information
soul-codes committed Dec 21, 2024
1 parent e3518ed commit 387de75
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from filelock import FileLock
from pydantic import BaseModel
from tinydb import Query, TinyDB
from xlsxwriter import Workbook

from analyzer_interface.interface import AnalyzerOutput

Expand Down Expand Up @@ -180,7 +181,9 @@ def _save_output(
elif extension == "csv":
output_df.sink_csv(output_path)
elif extension == "xlsx":
output_df.collect().write_excel(output_path)
# See https://xlsxwriter.readthedocs.io/working_with_dates_and_time.html#timezone-handling
with Workbook(output_path, {"remove_timezone": True}) as workbook:
output_df.collect().write_excel(workbook)
elif extension == "json":
output_df.collect().write_json(output_path)
else:
Expand Down

0 comments on commit 387de75

Please sign in to comment.