Hi everyone,
I am trying to create a table with conditional formatting for the font color, for example, if numbers are > 0 the font will be back and if they are < 0 the font will be red.
The problem is that when I run the code it shows me a error โโ<=โ not supported between instances of list and intโ.
Here is the code:
fisrt_column = ['Core Stores', 'AB', 'BC', 'MB', 'ON', 'SK', 'Total']
vals = [fisrt_column, vals_gross_week, vals_net_week, vals_guest_week, vals_avgcheck_week, vals_netcapture_week, vals_gross_period, vals_net_period, vals_guest_period, vals_gross_year, vals_net_year, vals_guest_year, vals_avgcheck_year, vals_netcapture_year]
#the variables, such as vals_gross_week, are a list of floats
trace_table_overall = go.Table(
domain=dict(x=[0, 1],
y=[0.7, 1]),
columnwidth=[2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
columnorder=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
header=dict(values=[['', ''],
['', 'Gross Sales'],
['', 'Net Sales'],
['<b>Week<b>', 'Guest Count'],
['', 'Avg Check'],
['', 'Net Sales Capture'],
['', 'Gross Sales'],
['<b>Period<b>', 'Net Sales'],
['', 'Guest Count'],
['', 'Gross Sales'],
['', 'Net Sales'],
['<b>Year<b>', 'Guest Count'],
['', 'Avg Check'],
['', 'Net Sales Capture']],
line = dict(color=['#6B2626', '#6B2626', '#6B2626', '#6B2626', '#6B2626', '#6B2626',
'#47546D', '#47546D', '#47546D', '#437D55', '#437D55', '#437D55', '#437D55', '#437D55']),
fill = dict(color=['#6B2626', '#6B2626', '#6B2626', '#6B2626', '#6B2626', '#6B2626', '#47546D',
'#47546D', '#47546D', '#437D55', '#437D55', '#437D55', '#437D55', '#437D55']),
font=dict(family="Arial", size=12, color='white'),
align = ['center'] * 5),
cells=dict(values=vals,
line = dict(color='#CCCCCC'),
fill_color = [colors_overall],
font=dict(family="Arial", size=10,
color=['darkslategray', ['red' if val<=0 else 'blue' for val in vals]]),
align = ['center'] * 5))
Does anybody know what is wrong?