✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Dash DataTable - Conditional Formatting based on row values

is there a way to apply Conditional Formatting based on row values on a Dash DataTable.
For example, I would like to highlight the cell that has the highest/lowest value among all columns on that row, and repeat that for every row.

Thank you in advance

Checkout the user guide…Part 2. https://dash.plot.ly/datatable

I did before posting, yet I haven´t managed it.

what I want is sth like this:

yet I do not want to explicitly write the conditional format for every row with a known maximum, as I have a variable number of columns and sometimes variable number of rows.

I had the same issue and i found that we can give index directly rather than a condition. Check this out.

style_data_conditional = [{'if': {'column_id': x, 'row_index': y},
                         'backgroundColor': '#3D9970','color': 'white'} for x,y  in zip((df.idxmax(axis=1)), df.index)]

you can find the answer here:

1 Like