I'm Trying to construct a bar chart with the colour of the bars being influenced from the boolean value on the same row in the dataframe. In this example I'm wanting has_chocolate with False to be red and True to be green when sales are put in a bar chart.
import pandas as pd
import matplotlib.pyplot as plt
cake_sales_df
index cake sales has_chocolate
0 empire 15 False
1 tea cake 25 True
2 snowball 20 True
3 hob-nob 50 True
4 lotus 3 False
What I've attempted so far with using an outside function or a condition
cake_sales_df.plot(x='cake', y='sales',
kind='bar', color = 'green' if cakes_sales_df['has_chocolate'] == True else 'red')
have all gotten me the same error
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

