Skip to content

Commit f786ad3

Browse files
committed
don't check against the selected row and correct comment
Signed-off-by: John Seekins <john@robot-house.us>
1 parent a22293f commit f786ad3

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

file_utils.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ def export_to_file(
2323
writer = convert_to_dataframe(facilities_data["facilities"])
2424
match file_type:
2525
case "xlsx":
26-
"""
27-
objects end up with dates without timezones, so trying to guess it can
28-
mess up the translation to XLSX.
29-
"""
26+
# Excel doesn't support timezones properly, so...
3027
with xlsxwriter.Workbook(full_name, {"remove_timezone": True}) as wb:
3128
_ = writer.write_excel(workbook=wb, include_header=True, autofit=True)
3229
case "csv":

utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ def _flatdict(d: dict, parent_key: str = "", sep: str = ".", list_sep: str = ","
8282
if not v:
8383
items.append((new_key, ""))
8484
elif isinstance(v[0], dict):
85-
logger.info("List of dicts: %s", v)
8685
for idx, value in enumerate(v):
8786
items.extend(_flatdict(value, f"{new_key}{sep}{idx}", sep=sep, list_sep=list_sep).items())
8887

@@ -102,11 +101,12 @@ def convert_to_dataframe(d: dict) -> polars.DataFrame:
102101
"""
103102
longest: list = list(flatdata[0].keys())
104103
longest_len: int = len(longest)
105-
for dobj in flatdata:
104+
for dobj in flatdata[1:]:
106105
keys = list(dobj.keys())
107106
if len(keys) > longest_len:
108107
longest = copy.deepcopy(keys)
109108
longest_len = len(longest)
109+
logger.info("Key list is: %s", longest)
110110
fieldnames = [k for k in longest if k not in flatdata_filtered_keys]
111111
# https://docs.pola.rs/api/python/stable/reference/api/polars.from_dicts.html
112112
df = polars.from_dicts(flatdata, schema=fieldnames)

0 commit comments

Comments
 (0)