Skip to content

Commit

Permalink
No dict union for 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrumiller committed Jul 25, 2024
1 parent b5f72b7 commit c7cc745
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions py-polars/polars/io/spreadsheet/_write_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,9 @@ def _map_str(s: Series) -> Series:
# associate formats/functions with specific columns
header_dict = header_format or {}
add_align = "align" not in header_dict
header_alignment = {"align": "right"} | ({"indent": 2} if autofilter else {})
header_alignment = {"align": "right"}
if autofilter:
header_alignment["indent"] = 2 # type: ignore[assignment]
col_header_format = {}
for col, tp in df.schema.items():
base_type = tp.base_type()
Expand All @@ -462,7 +464,7 @@ def _map_str(s: Series) -> Series:
fmt = dtype_formats.get(tp, dtype_formats[base_type])
column_formats.setdefault(col, fmt)
if add_align and base_type in [*FLOAT_DTYPES, *INTEGER_DTYPES]:
header_fmt = header_dict | header_alignment
header_fmt = {**header_dict, **header_alignment}
if col not in column_formats:
column_formats[col] = fmt_default

Expand Down

0 comments on commit c7cc745

Please sign in to comment.