How to embed images to pandas DataFrame and show in flask webpage How to embed images to pandas DataFrame and show in flask webpage flask flask

How to embed images to pandas DataFrame and show in flask webpage


Image is not rendering, because the markup is encoded as text, not as htmlIf you looking to render image from dataframe, you need to use Markup().unescape() method.

html = Markup(dataframeName.to_html(classes='data')).unescape() 

This will convert &lt to < and likewise other symbols to tags.

If you want to see, why this is happening, you can F12 in chrome, select tag and right click > edit as html, you will see that your image tag is looking something like:<img src='url_path'>however, it should look like: <img src='url_path'>