Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(python): Improve default write_excel int/float format when using a dark "table_style" #17869

Merged

Conversation

alexander-beedie
Copy link
Collaborator

@alexander-beedie alexander-beedie commented Jul 25, 2024

Much better default output when given a "dark" table_style:

Example

import polars as pl

df = pl.DataFrame({
    "dtm": [date(2023, 1, 1), date(2023, 1, 2), date(2023, 1, 3)],
    "str": ["xxx", "yyy", "xxx"],
    "val": [100.5, 55.0, -99.5],
})

df.write_excel(
    workbook="output.xlsx",
    table_style="Table Style Dark 2",
    column_totals=True,
    autofit=True,
)

Before:

Numeric formatting does not look good with dark styles -

Screenshot 2024-07-25 at 17 46 17

After:

Screenshot 2024-07-25 at 17 46 11

@github-actions github-actions bot added fix Bug fix python Related to Python Polars labels Jul 25, 2024
@alexander-beedie alexander-beedie changed the title fix(python): Improve default write_excel int/float format when using an explicit "table_style" fix(python): Improve default write_excel int/float format when using a dark "table_style" Jul 25, 2024
Copy link

codecov bot commented Jul 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.48%. Comparing base (3016c07) to head (90faf67).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #17869   +/-   ##
=======================================
  Coverage   80.47%   80.48%           
=======================================
  Files        1505     1505           
  Lines      197273   197278    +5     
  Branches     2807     2808    +1     
=======================================
+ Hits       158764   158776   +12     
+ Misses      37987    37980    -7     
  Partials      522      522           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ritchie46 ritchie46 merged commit 9625c82 into pola-rs:main Jul 25, 2024
26 checks passed
@alexander-beedie alexander-beedie deleted the xl-table-style-numeric-formats branch July 25, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants