Skip to content

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

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

Closed
3 tasks done
attack68 opened this issue Feb 10, 2021 · 0 comments · Fixed by #40334
Closed
3 tasks done

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

attack68 opened this issue Feb 10, 2021 · 0 comments · Fixed by #40334
Labels
Regression Functionality that used to work in a prior pandas version Styler conditional formatting using DataFrame.style
Milestone

Comments

@attack68
Copy link
Contributor

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Addressing #39396 and #39395 means that after Styler._compute() or Styler.render() the _todo list is cleared.

Since Styler.export = lambda x: Styler._todo
and Styler.use = lambda x: Styler._todo.extend(x)

This means that exporting styles cannot be achieved if a Styler has been rendered at least once.

Possible actions:

  1. Update the docs to make users aware of the new behaviour and suffer any regression issues for export use.
  2. Revert the original PR, suffering the duplicate CSS in HTML generated on each render.
  3. Solve both issues by clearing the .ctx object before render and keeping the _todo list, suffering the need to recompute all applied styles on each render.

Perhaps 3 is best - If performance is an issue developers should know only to every render once?

@attack68 attack68 added Bug Needs Triage Issue that has not been reviewed by a pandas team member Styler conditional formatting using DataFrame.style Regression Functionality that used to work in a prior pandas version and removed Needs Triage Issue that has not been reviewed by a pandas team member Bug labels Feb 10, 2021
@jreback jreback added this to the 1.3 milestone Mar 10, 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 a pull request may close this issue.

2 participants