Here is the dataframe which i have used :
i have tried following code :
def color_red_or_green(val):
color = 'green' if val >= 70 else 'orange' if val < 70 & val >= 40 else "red"
return 'color: %s' % color
week2_Percentage.style.apply(color_red_or_green, subset = ['availability'])
Which maps condition of the column name availbility for background color but got following error :
CodePudding user response:
The apply function is performed "column-wise, row-wise, or table-wise" according to its