Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

give cell format to condition pandas dataframe

import pandas as pd
df = pd.DataFrame([[2,3,1], [3,2,2], [2,4,4]], columns=list("ABC"))

df.style.apply(lambda x: ["background: red" if v > x.iloc[0] else "" for v in x], axis = 1)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #give #cell #format #condition #pandas #dataframe
ADD COMMENT
Topic
Name
5+5 =