Skip to content

BUG/ENH: Translate CSS border properties for Styler.to_excel #45312

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

Merged
merged 30 commits into from
Feb 11, 2022

Conversation

tehunter
Copy link
Contributor

@tehunter tehunter commented Jan 11, 2022

@pep8speaks
Copy link

pep8speaks commented Jan 11, 2022

Hello @tehunter! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2022-02-10 13:27:41 UTC

@tehunter

This comment has been minimized.

Copy link
Contributor

@attack68 attack68 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also look to add a roundtrip test in pandas/tests/io/excel/test_style.py

@tehunter
Copy link
Contributor Author

Any idea what could be causing the failure? It's something related to filesystems in test_arrowparquet_options, which I haven't touched.

@attack68
Copy link
Contributor

Looking really good, especially the style round trip. Just one or two comments for optimisation.

@attack68
Copy link
Contributor

can you show a test that exerices this at a high level as well

Its difficult to test this since you have to write to excel and then read that the file rendered correctly.

The round trip tests I requested in test_style.py now do this: explicitly they check that:

a) The styled dataframe (with a border) is different to the unstyled dataframe (without border)
b) that the excel file created is read in correctly by openpyxl and has the border styles as expected.

@tehunter
Copy link
Contributor Author

needs a whats new 1.5.0, (maybe 1.4.1 if it can be backported).

Do I write the entry or does a maintainer do that? I propose 2 entries along the lines of:

  • Bug Fix: Fixed bug in CSSToExcelConverter leading to TypeError when border color provided without border style for xlsxwriter engine (GH42276)
  • Enhancement / Styler Enhancements: Added the ability to render border and border-{side} CSS properties in Excel (GH42276)

@jreback
Copy link
Contributor

jreback commented Jan 16, 2022

@tehunter u add them

@jreback jreback added this to the 1.5 milestone Jan 17, 2022
@jreback
Copy link
Contributor

jreback commented Jan 17, 2022

looks fine (but before i resolved i think the doc-build was failing) so let's check that.

@jreback
Copy link
Contributor

jreback commented Jan 17, 2022

@tehunter
Copy link
Contributor Author

@github-actions pre-commit

@attack68
Copy link
Contributor

attack68 commented Feb 8, 2022

@tehunter if you get a chance to merge with main, i can take a look at the CI errors you are getting

Styler
^^^^^^

- Fixed bug in :class:`CSSToExcelConverter` leading to ``TypeError`` when border color provided without border style for ``xlsxwriter`` engine (:issue:`42276`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just put this in the I/O section

@jreback jreback merged commit 65ecb90 into pandas-dev:main Feb 11, 2022
@jreback
Copy link
Contributor

jreback commented Feb 11, 2022

thanks @tehunter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO Excel read_excel, to_excel Styler conditional formatting using DataFrame.style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants