Skip to content

BUG: fix regression in Styler.export/use #40334

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 5 commits into from
Mar 10, 2021

Conversation

attack68
Copy link
Contributor

@attack68 attack68 commented Mar 9, 2021

#39396 solved a bug that CSS was duplicated everytime a Styler rendered. The solution maintained the computed ctx object and cleared the _todo list of methods so it wasn't recalculated. This broke the export and use methods since they rely on passing methods from the _todo list.

This PR solves the above duplication problem by clearing the ctx object before each render, maintaining the _todo from one render to another, and therefore fixes the broken methods.

@attack68 attack68 changed the title fix regression in Styler.export/use BUG: fix regression in Styler.export/use Mar 9, 2021
@jreback jreback added the Code Style Code style, linting, code_checks label Mar 9, 2021
@jreback jreback added this to the 1.3 milestone Mar 9, 2021
@jreback
Copy link
Contributor

jreback commented Mar 9, 2021

is there anything user visible that would have changed? can you make a test that exercises this? (i see you change the internal test which is good as well).

@attack68
Copy link
Contributor Author

No the ctx obj is no documented, is complex and the user should never, and is unlikely, to be using it directly.

There was an existing test_export, it just didn't pick up the case where a Styler had been rendered so now this is modified.

@jreback jreback merged commit 3140ef1 into pandas-dev:master Mar 10, 2021
@jreback
Copy link
Contributor

jreback commented Mar 10, 2021

cool thxs

@attack68 attack68 deleted the regression_export branch March 10, 2021 19:09
jbrockmendel pushed a commit to jbrockmendel/pandas that referenced this pull request Mar 11, 2021
@attack68 attack68 added Styler conditional formatting using DataFrame.style Regression Functionality that used to work in a prior pandas version and removed Code Style Code style, linting, code_checks labels Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Regression Functionality that used to work in a prior pandas version Styler conditional formatting using DataFrame.style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Styler export() and use() no longer work after Styler has been rendered.
2 participants