How to display dataframe out in multiline

I am displaying a dataframe output as st.write(df). However, there are some columns which have long text.

While it is great and easy to display the output of data frame using Streamlite, column values get truncated if they are too large.

Has anyone overcome this situation by applying a work around. Would be interested to hear from the experts here.


Hi @Arun :sunglasses: could you please make available a snippet of you code and a image of the problem you are dealing with?

Hi feliperoque,

Here it is.

I have a column called Observation in my dataframe which contains a value eg “William%R & Stochastic are Oversold. RSI close to Oversold.”

However, when it is displayed in streamlit I can see only see the first 23 characters of the value. Anything above 23 is truncated and displayed as triple dots “…”

I used
“st.dataframe(df)” to display my dataframe in streamlit.

I even tried using st.write(df) also but it gives me the same result.

I have attached the screenshot of the dataframe output in both excel and streamlit.


Hope this helps.

hi, you can use streamlit-aggrid module to show your dataframe on web page, it is very simple and friendly
install method:
pip install streamlit-aggrid

from st_aggrid import AgGrid
import streamlit as st
import pandas as pd
dataframe=pd.read_excel(“your excel file name”)
AgGrid(dataframe, height=500, fit_columns_on_grid_load=True)


Thanks BeyondMyself, Aggrid is awesome. It gives me options to resize column and also enable filter without adding any extra code. I am going to love this.

But one thing I noticed is that, I have now lost the expander which used to appear on the right side of the table output. I am sure there must be a way to achieve this in AgGrid. I will have a go and read the documenation to try different features. Thanks for your support.

1 Like