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_max_and_min(df): df.style.highlight_max(axis=1, props='color:white;\ font-weight:bold;\ background-color:green;') df.style.highlight_min(axis=1, props='color:white;\ font-weight:bold;\ background-color:brown;') return df