pasteur.utils.mlflow.color_dataframe#
- pasteur.utils.mlflow.color_dataframe(df, idx, cols, vals, split_ref='tst', split_col='split', cmap='BrBG', cmap_ref='Purples', diff_reverse=True, formatters=None)[source]#
Creates a pivot table with idx, cols, vals fed into the pandas.pivot(), with an additional column level based on split_col.
The columns that have split_col equal to split_ref have a background_color() applied on their values with cmap cmap_ref. The other columns have a symmetrical cmap cmap applied to them based on their normalized difference with split_ref.
With diff_reverse, the cmap applied on the other columns is flipped. That way, the colors used for positive/negative can be flipped.
formatters contains a dict of col to format() parameters. A col can be one of any in vals. A subset is calculated based on the col name and it is placed along with the other parameters in the format() function.