2

I have a large (vertically) pandas Dataframe that I would like to display as a nice table with (vertical) scrollbars in a jupyter notebook in vs code.

I have come across post that addresses the solution, but it is 5 years old, so was wondering if there is now a better method. Here is the post: Pandas DataFrame Table Vertical Scrollbars

Right now I use the following to see all the data:

pd.set_option("display.max_rows", None)

But this shows all the rows which becomes problematic when, say >100 rows.

Just to be clear, i am looking for a scroll bar (as in the image): enter image description here

D.L
  • 4,339
  • 5
  • 22
  • 45

1 Answers1

2

I don't think there is a solution for plain Jupyter, but for the successor JupyterLab it's quite easy, not just for DataFrames but for all outputs.

It looks like this:

Output of pd.DataFrame(range(100)) with scrolling output enabled

To enable this view you have to set pd.set_option("display.max_rows", None) and then you have to make a right-click on the blue column and choose Enable Scrolling for Outputs:

Right click menu showing the "Enable Scrolling for Outputs" option

Saaru Lindestøkke
  • 2,067
  • 1
  • 25
  • 51
Thomas R
  • 1,067
  • 11
  • 17
  • 1
    Is there a way to programmatically enable scrolling for outputs? i.e., call it from the code rather than forcing user to click it. – LogZ Sep 08 '22 at 00:04
  • @LogZ If there is, I would appreciate knowing it as well. But I did not see something like this yet. – Thomas R Sep 28 '22 at 20:36