rstoolbox.utils.
highlight
(row, selection, color='yellow', text_color='black', bold=True, for_image=False)¶Highlight rows in Jupyter Notebooks that match the given index.
Parameters: |
|
---|---|
Returns: | CSS properties for the cells. |
Note
Make the html output into an image with wkhtmltopdf
and its python wrapper imgkit
.
wkhtmltopdf
installation depends on the operating system. While for linux it might work
with get-apt or similar, here are some tips for the
macOS installation.
Then, one might make it with a call such as:
imgkit.from_string(df.style.apply(rstoolbox.utils.highlight, selection=topside,
for_image=True, axis=1).render(),
'out.png')
Take notice of the use of the for_image
attribute. You can try to add more CSS rules with
pandas.Styler.set_table_styles()
. This seems to work properly for td
and th
but not for
table
or tr
.