How to Use For loop to print DataFrame without using Streamlit Package

Hello Friends,

I am beginner in Python and Streamlit can we help me in the problem

I am trying to Show case Table using HTML code where i am passing the dataframe in For loop in Markdown below is the Code but getting error in VSCODE

st.markdown(f"""
      <table class="table-dark table-striped-columns">
          <thead>
              <tr>
                  {% for header in dt.columns %}
                  <th scope="col">{{ header }}</th>
                  {% endfor %}
              </tr>
          </thead>
      </table> 
      """,unsafe_allow_html= True)

You could use the jinja2 package for this.

2 Likes

Hello Franky Do you have any example which show how we can use Jinja2 package in streamlit.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.