简体   繁体   English

如何在没有Jupyter Notebook崩溃的情况下显示DataFrame?

[英]How to display a DataFrame without Jupyter Notebook crashing?

Everytime I try to display a complete DataFrame in my jupyter notebook, the note book crashes. 每当我尝试在jupyter笔记本中显示完整的DataFrame时,笔记本便会崩溃。 The file wont start up so I had to make a new jupyter notebook file. 该文件将不会启动,所以我不得不制作一个新的jupyter笔记本文件。 When i do display(df) it only shows a couple of the rows, when I need to show 57623 rows. 当我执行display(df)时,它只显示几行,而我需要显示57623行。 I need to show results for all of these rows and put them into an html file. 我需要显示所有这些行的结果,并将它们放入html文件中。

I tried setting the max rows and max columns, but the entire dataframe would not print out without the notebook crashing 我尝试设置最大行数和最大列数,但如果笔记本计算机不崩溃,整个数据框将无法打印出来

''' python pd.set_option('display.max_columns', 24) "pd.set_option('display.max_rows', 57623) ''' '''python pd.set_option('display.max_columns',24)“ pd.set_option('display.max_rows',57623)'''

The expected results were for the entire DataFrame to print out, but instead the notebook would have an hourglass next to it and nothing would load. 预期的结果是整个DataFrame都可以打印出来,但是笔记本旁边会有一个沙漏,因此不会加载任何内容。

I think your machine is not powerful enough to handle so much data. 我认为您的计算机功能不足以处理大量数据。 I can display 57623 rows for my data (with 16 columns) without any problem. 我可以为我的数据display 57623行(带有16列),没有任何问题。 But my machine has 252GB memory, and it still took about 1 minute to display these data in jupyter notebook. 但是我的机器有252GB内存,仍然需要大约1分钟才能在jupyter笔记本中显示这些数据。

If I tried to scroll through the data, it's slow, and sometimes stuck for a while. 如果尝试滚动浏览数据,速度会很慢,有时会停留一会儿。

On the other hand, what do you want to achieve by displaying all data here? 另一方面,您想通过在此处显示所有数据来实现什么? There's definitely another way to achieve the same thing as you are doing now. 当然,还有另一种方法可以实现与现在相同的功能。

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

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