How do I apply a function that highlights cells of a particular df column a given color on a julia DataFrame for output into a Jupyter notebook?
using DataFrames
using Crayons
crayon_red_light = Crayon(foreground = :white, background = :light_red)
# Tried this
highlight_max = PrettyTables.Highlighter((data, i, j) -> crayon_red_light)
PrettyTables.pretty_table(df, highlighters = (highlight_max,))
# And this
for (i, row) in enumerate(eachrow(output_df))
PrettyTables.hl_cell(i, findfirst(isequal("intensity_color"), names(output_df)), crayon_red_light)
end
PrettyTables.pretty_table(output_df)
If the goal is to have the maximum of each row highlighted, rummaging around the PrettyTables docs, led me to the following code:
Well, the table as it in the answer doesn't show the appropriately colored bits, but they are colored... As a bonus, to enable showing which cells are highlighted, the following is a Formatter setup to surround maximum values in row with stars: