Before clicking “Create Topic”, please make sure your post includes the following information (otherwise, the post will be locked).
- Are you running your app locally or is it deployed?: Locally
- If your app is deployed:
a. Is it deployed on Community Cloud or another hosting platform?: NA
b. Share the link to the public deployed app.: NA - Share the link to your app’s public GitHub repository (including a [requirements file]: (App dependencies - Streamlit Docs)).: NA
- Share the full text of the error message (not a screenshot).:NA
- Share the Streamlit and Python versions.: python==3.8.10, streamlit==1.11.0
Hello friends, I have a pandas dataframe in which one of the column contains HTML codes. I am using streamlit app to display the dataframe in UI. How do I hide the HTML code and display it as a hyperlink preferrably click here
and when clicked it should render the code and display as a HTML page?
Here is the pseudo code:
import pandas as pd
import streamlit as st
data_df = pd.DataFrame(
{
"id": [1,2,3,4],
"apps": [
"<!DOCTYPE html>\
<html>\
<body>\
\
<h1>Heading 1</h1>\
</body>\
</html>",
"<!DOCTYPE html>\
<html>\
<body>\
\
<h1>Heading 2</h1>\
</body>\
</html>",
"<!DOCTYPE html>\
<html>\
<body>\
\
<h1>Heading 3</h1>\
</body>\
</html>",
"<!DOCTYPE html>\
<html>\
<body>\
\
<h1>Heading 4</h1>\
</body>\
</html>",
],
}
)
st.write(data_df)
This is how it is displayed now: