Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

dataframe conditional formatting max values

# Function to highlight text of max value in a dataframe
def highlight_max(s):
    is_max = s == s.max()
    return ['color: green' if cell else '' for cell in is_max]
  
df.style.apply(highlight_max,axis=1)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #dataframe #conditional #formatting #max #values
ADD COMMENT
Topic
Name
9+3 =