Skip to content
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

ENH: add render_links for Styler.to_html formatting #45058

Merged
merged 7 commits into from
Dec 28, 2021

Conversation

attack68
Copy link
Contributor

@attack68 attack68 commented Dec 24, 2021

This came about as a requirement for converting DataFrame.to_html into Styler.to_html, citing @jorisvandenbossche in favour of the functionality.

Note that the DataFrame.to_html render_links argument is rather limited to just detecting only a URL in a cell.

The function added for Styler here is a more general pattern search, and it allows the result to be viewed in Jupyter Notebook directly, which the precursor does not.

Screen Shot 2021-12-24 at 22 20 45

@mroeschke mroeschke added Enhancement Styler conditional formatting using DataFrame.style labels Dec 24, 2021
@attack68
Copy link
Contributor Author

Please note I added the LaTeX equivalent, so the signature is now consistent with the escape argument (in {"html", "latex"}.

Also note I changed the argument name to hyperlinks from render_links. Comments welcome.

@jreback jreback added this to the 1.4 milestone Dec 27, 2021
@@ -798,6 +798,7 @@ def format(
decimal: str = ".",
thousands: str | None = None,
escape: str | None = None,
hyperlinks: str | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a reason we prefer this to render_links?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My arguments: hyperlink is a bit more specific whereas link can be a general term in certain contexts. And, technically, everything is rendered so why not add render to every kwarg. And rendering is somewhat of an esoteric concept outside of graphics processing.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok fair

@jreback jreback merged commit 3c19380 into pandas-dev:master Dec 28, 2021
@jreback
Copy link
Contributor

jreback commented Dec 28, 2021

thanks @attack68

@jreback
Copy link
Contributor

jreback commented Dec 28, 2021

i was not sure if there was an actual issue for this (aside from the discussion), if so can you link.

@attack68 attack68 deleted the format_render_links branch December 28, 2021 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Styler conditional formatting using DataFrame.style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants