**testdict** = {'Dict_1': {'Start Time': '06-10-2020 13:08:58', 'Test Type': 'ERP_To_DBO','CountMatch Result': 'Failed', 'End Time': '06-10-2020 13:09:16'},
'Dict_2': {'Start Time': '06-10-2020 13:09:21', 'Test Type': 'ERP_To_DBO','CountMatch Result': 'Failed', 'End Time': '06-10-2020 13:11:53'},
'Dict_2': {'Start Time': '06-10-2020 13:11:59', 'Test Type': 'ERP_To_DBO', 'CountMatch Result': 'Failed', 'End Time': '06-10-2020 13:13:19'}}
I want to highlight value 'failed' with red and 'Passed' with green.
df = pd.DataFrame(data=testdict)
def color_negative_red(val):
color = 'red' if val == 'Failed' else 'black'
return 'color: %s' % color
df = df.style.apply(color_mapper)
df.transpose().to_html(filename)
I have tried many things listed in https://pandas.pydata.org/pandas-docs/stable/user_guide/style.html but didn't got any success.
once the style has applied i have to transpose the entire DF and render a DataFrame as an HTML table.