I'm trying to change the font color of the strings in df1 that are in df3 in Pandas. My data sets are:
df1 = [ "i like to shop at store a." , "he likes to shop at the store b.", "she is happy to shop at store c.", 'we want to shop at the store d.']
df2 = [ "store a", "store b", "store c", 'store d' ]
df3 = [ "like to", "likes to shop", "at store" ]
myDataSet = list(zip(df1,df2))
df = pd.DataFrame(data = myDataSet, columns=['df1', 'df2'])
To change the color of the strings in df1, I'm using the following but get invalid syntax error. Please help.
def color_negative_red(df1):
x for x in df3 if x in df["df1"]
return 'color: %s' % color
s = df.style.applymap(color_negative_red)
s