Generation

generate functionMon, 20 Feb 2023

There is a Pandas code: df2.style.highlight_max(axis=1, props='color:white;\ font-weight:bold;\ background-color:green;') df2.style.highlight_min(axis=1, props='color:white;\ font-weight:bold;\ background-color:brown;') Write a function that combines these two actions into one and returns the changed dataframe

def highlight_min_max(df1): return df1.style.highlight_max(axis=1, props='color:white;\ font-weight:bold;\ background-color:green;').apply(highlight_min, axis=1, props='color:white;\ font-weight:bold;\ background-color:brown;') highlight_min_max(df2)

Questions about programming?Chat with your personal AI assistant