Skip to content

Commit

Permalink
fix: Fix operator precedence oversight in write_excel that could le…
Browse files Browse the repository at this point in the history
…ad to incorrect spanning range determination
  • Loading branch information
alexander-beedie committed Apr 13, 2024
1 parent 6ec2d6e commit ac8a02e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions py-polars/polars/io/spreadsheet/_write_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ def _xl_column_range(
"""Return the excel sheet range of a named column, accounting for all offsets."""
col_start = (
table_start[0] + int(include_header),
table_start[1] + df.get_column_index(col) if isinstance(col, str) else col[0],
table_start[1] + (df.get_column_index(col) if isinstance(col, str) else col[0]),
)
col_finish = (
col_start[0] + len(df) - 1,
col_start[1] + 0 if isinstance(col, str) else (col[1] - col[0]),
col_start[1] + (0 if isinstance(col, str) else (col[1] - col[0])),
)
if as_range:
return "".join(_xl_rowcols_to_range(*col_start, *col_finish))
Expand Down

0 comments on commit ac8a02e

Please sign in to comment.