I have a Pandas dataframe that is displayed like this in html:
df = pd.DataFrame([
[54, 21, 30, 12, '20-01-2002'],
[52, 26, 31, 2, '22-01-2002'],
[50, 16, 11, 15, '223-01-2002']
], columns=['A', 'B', 'C', 'D', 'date']).transpose()
When rendering the dataframe as HTML, I need to display a trend icon (up or down arrow )on the first column comparing it to the values in the 2nd column so the final html is rendered something like this:
First I thought it would be as easy as adding a span tag with the arrow to the dataframe.
<span style="color:green;">▲</span> <!-- For Up Arrow -- >
<span style="color:green;">▼</span> <!-- For Down Arrow -- >
So i tried adding that to the dataframe
df['A'] = df['A'].astype('str') + <span style="color:green;">▲</span>
but when renderred as html, styler tries to escape the span tag and it is displayed as a text. I have tried using both escape=''html & escape='latex'
lated worked for span tag but still escapes the & with &
I am not very familiar with how styler works, so need help.




