Skip to content

ENH: Use a proper CSS parser for pandas Styler objects #48868

Open
@marknsikora

Description

@marknsikora

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

The existing pandas Styler makes use of CSS extensively but is done so with a naïve parser. This has resulted in a number of hacky workaround to get values like the literal ; passed through, see #46239, #40596, #40422, and #41619.

Using a real parser here would remove the need for workaround.

There are also other cases that are currently impossible with the existing implementation. Eg. all CSS values passes into the Excel Styler get converted to lower case with no escape hatch.

Feature Description

Rip out all custom CSS parsing code and replace with a standard parser line tinycss/tinycss2. Both packages with relatively few additional dependencies.

Alternative Solutions

Write our own more complete CSS parser.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementStylerconditional formatting using DataFrame.style

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions