Skip to content

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

Closed
@attack68

Description

@attack68
  • 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    RegressionFunctionality that used to work in a prior pandas versionStylerconditional formatting using DataFrame.style

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions