Printing column in dataframe to list in streamlit

Hi, I am trying to print the index of a data frame as a list but I have trouble doing that in Streamlit. In Python, it would look like this. Do you have suggestions for me?

print(df.index.tolist())

This doesn’t work as hoped:
st.write(df.index.tolist())

Thanks.

Hi,

Can you please provide the error message or the expected result?

I don’t get an error message. I just get a list that doesn’t look the way I hope: Screen Shot 2020-10-01 at 5.16.42 PM

How do I reformat that so that it appears as a list in more of a sentence form.

Hm, you could try

st.markdown(df.index.tolist())

Is that what you want?

Best, Alex

1 Like

Yes thank you!

1 Like