IPython Notebook output cell is truncating contents of my list
PythonIpythonIpython NotebookPython Problem Overview
I have a long list (about 4000 items) whose content is suppressed when I try to display it in an ipython notebook output cell. Maybe two-thirds is shown, but the end has a "...]", rather than all the contents of the list. How do I get ipython notebook to display the whole list instead of a cutoff version?
Python Solutions
Solution 1 - Python
pd.options.display.max_rows = 4000
worked for me
See : http://pandas.pydata.org/pandas-docs/stable/options.html
Solution 2 - Python
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
Solution 3 - Python
This should work:
print(str(mylist))
Simple!
Solution 4 - Python
How to disable list truncation in IPython:
- Create an IPython config file if you don't already have one:
ipython profile create
- Edit the config file to include this line:
c.PlainTextFormatter.max_seq_length = 0
- Restart your notebook instance.
Solution 5 - Python
The following line prints everything in your list in a readable manner.
[print(x) for x in lis]
Solution 6 - Python
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())
Solution 7 - Python
For cases where the output of print(mylist)
is something like [1, 1, 1, ..., 1, 1, 1]
then [*mylist]
will expand the items into rows where all items are visible.
Solution 8 - Python
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.
Solution 9 - Python
just use the print command instead of calling the list directly. Like print mylist . It would not truncate then.