IPython Notebook output cell is truncating contents of my list

[亡魂溺海] 提交于 2019-11-27 09:00:48
pd.options.display.max_rows = 4000

worked for me

See : http://pandas.pydata.org/pandas-docs/stable/options.html

I know its a pretty old thread, but still wanted to post my answer in the hope it helps someone. You can change the number of max_seq_items shown by configuring the pandas options as follows:

pd.options.display.max_seq_items = 2000

This should work:

print str(mylist)

Simple!

A quick hack if you're using pandas is to do

from pandas import DataFrame
from IPython.display import HTML
HTML(DataFrame(myList).to_html())

Here's a way to display the whole list in the IPython output cell that doesn't require Pandas:

from IPython.display import HTML
x = range(4000)
HTML('<br />'.join(str(y) for y in x))

It is also pretty easy to add additional HTML elements and get a more elaborate display. Clicking to the left of the output cell will now shrink the contents and add a local scroll bar.

just use the print command instead of calling the list directly. Like print mylist . It would not truncate then.

The following line prints everything in your list in a readable manner.

[print(x) for x in lis] 

How to disable list truncation in IPython:

  1. Create an IPython config file if you don't already have one:
    ipython profile create
    
  2. Edit the config file to include this line:
    c.PlainTextFormatter.max_seq_length = 0
    
  3. Restart your notebook instance.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!