I'm having trouble getting my dataframe to HTML when using style.apply().
Using this line of code throws the same error whether I use .render() or .to_html()
df = pd.read_csv(r'C:\test_data.csv') print(df.style.apply(lambda x: f"color: {'red' if x == 'BAD' else 'black'}", axis=1).to_html()) ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
However, when I use .applymap() I can use .to_html() without any errors but I want the condition to be applied row-wise and not element-wise.