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.

Setting dataframe width doesn't have effect

See original GitHub issue

Summary

Providing st.dataframe a width doesn’t seem to have the desired effect.

Steps to reproduce

Code snippet:

st.dataframe(df, width=1200)
Screen Shot 2022-07-04 at 9 42 00 PM

That’s the output of the table, regardless of whether I give the width argument or not.

Expected behavior:

The table width is set to the integer number of pixels and the column widths are dispersed evenly within that width.

Actual behavior:

The table doesn’t change size.

Is this a regression?

Don’t think so.

Debug info

  • Streamlit version: 1.10
  • Python version: 3.9.13
  • OS version: OS X
  • Browser version: Chrome latest

Additional information

I believe this is due to the columns themselves not having width and just taking enough width to fit the values. But the header values (column names) seem to get ignored when making that calculation.

I tried to play around with the CSS but due to Canvas was unable to do things easily in inspection mode in the browser.

As an aside, would really like a full-width, responsive dataframe option (potentially as default).

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

5reactions
scott-trinklecommented, Aug 11, 2022

+1 for this, the current implementation is unusable, I have to use st._legacy_dataframe for all dataframes instead.

3reactions
TheRealJocicommented, Jul 29, 2022

Has there been any updates on this? This makes Dataframes unusable right?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I expand the output display to see more columns of ...
Width of the display in characters. In case Python/IPython is running in a terminal this can be set to None and pandas will...
Read more >
6 Pandas Display Options You Should Memorise
By default, Pandas only display content in a cell with a maximum width of 50. That is, a cell with more than 50...
Read more >
Options and settings — pandas 1.5.2 documentation
pandas has an options API configure and customize global behavior related to DataFrame display, data behavior and more. Options have a full “dotted-style”,...
Read more >
Setting the size of a figure in matplotlib and seaborn
Given all the different ways in pandas/seaborn/matplotlib to draw a ... size but shrinks the chart horizontally so it doesn't take up so ......
Read more >
How to Find Pandas DataFrame Size, Shape, and ...
In effect, this benchmark is so large that it would take an extraordinarily large data set to reach it. To provide some context,...
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