简体   繁体   English

Jupyter Notebook 中的 Pandas Dataframe 表垂直滚动条

[英]Pandas Dataframe Table Vertical Scrollbars in Jupyter Notebook

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 .我有一个大的(垂直)熊猫数据框,我想在vs codejupyter notebook中显示为带有(垂直)滚动条的漂亮表格。

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.我遇到过解决解决方案的帖子,但它已经有 5 年历史了,所以想知道现在是否有更好的方法。 Here is the post: Pandas DataFrame Table Vertical Scrollbars这是帖子: 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.但这显示了当 > 100 行时会出现问题的所有行。

Just to be clear, i am looking for a scroll bar (as in the image):为了清楚起见,我正在寻找一个滚动条(如图所示): 在此处输入图像描述

I don't think there is a solution for the old jupyter.我认为旧的 jupyter 没有解决方案。 But for the successor JupyterLab it's quite easy.但对于继任者 JupyterLab 来说,这很容易。 (Not just for DataFrames but for all outputs.) (不仅适用于 DataFrame,而且适用于所有输出。)

It looks like this.它看起来像这样。

在此处输入图像描述

To reach this view in you have to make a right-click on the blue column and choose 'enable scrolling for Outputs'.要到达此视图,您必须右键单击蓝色列并选择“为输出启用滚动”。

在此处输入图像描述

Btw: as you see I'm still using the pd.set_option("display.max_rows", None) .顺便说一句:如您所见,我仍在使用pd.set_option("display.max_rows", None)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM