question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to set dataframe column width

See original GitHub issue

See: https://discuss.streamlit.io/t/is-there-a-way-to-specify-column-width-for-dataframe-table/333

st.dataframe tries to be smart about column sizes, but often misses the mark — so users end up with dataframes that have truncated/ellipsized values.

On Jupyter, you can apply a width-modifying Styler to a dataframe like this: https://stackoverflow.com/a/39680725

We should add support for something like that in Streamlit.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:67
  • Comments:25 (2 by maintainers)

github_iconTop GitHub Comments

19reactions
corticalstackcommented, Feb 18, 2021

Any timeline for this (much wanted) feature? Thanks!

11reactions
wildyagupcommented, Jul 13, 2022

The new st.dataframe enforces column width based on its contents while truncating the header, which leads to “squeezing” of the rendered dataframe and unreadability of the header in some cases. Manual column resizing can partially solve this problem (except for the rightmost column), but it is inconvenient for the user when the number of columns is high. Previous UI allowed the dataframe to use all available screen width (in wide layout mode), didn’t truncate the header and displayed full column header text in a popup window on hover.

It would be nice to have access to “old-style” st.dataframe UI or the option to prevent header truncating in future updates.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can I set variable column widths in pandas? - Stack Overflow
I've not found an obvious way to set individual columns but this approach only scales up those that need more space to the...
Read more >
Pandas Column Width - Calmcode
In this short introduction we're doing to demonstrate how to use Pandas Column Width. ... you can use the pd.set_option method to set...
Read more >
Pandas: How to Set Column Widths - Statology
This tutorial explains how to specify a column width for a pandas DataFrame, including examples.
Read more >
6 Pandas Display Options You Should Memorise
6 Pandas Display Options You Should Memorise · 1. Set Max Number of Rows · 2. Set Max Number of Columns · 3....
Read more >
Simple Guide to Set Pandas Options to Better Display ...
display.max_colwidth - This option accepts integer value which let us width of columns. If our data frame cell has values that are more ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found