I'm trying to round and color values in my Pandas table. I would round the values to one decimal and color them depending on the column alarm which is 'Yes' or 'No'.
Here's my code:
pivot_table = pd.pivot_table(df, 'value', index = ['category', 'subcategory'], columns = ['date'], fill_value='-')
def color(alarm):
color = 'red' if df['alarm'] == 'Yes' else 'green'
return f'color: {color}'
sm_pivot_table.style.applymap(color)
I'm still getting the error message.