10

I am trying to display the contents of an Excel file in a Jupyter Notebook. However, a column named definition of the Excel sheet contains long strings. So when I display the DataFrame in the notebook, the long strings are truncated by ellipsis (...).

enter image description here

Is there a way to display the complete contents of the column in Jupyter Notebook? Since there is clearly space to the right that can utilized by the Definition column.

Sunit Gautam
  • 5,495
  • 2
  • 18
  • 31

2 Answers2

10

You can use options.display.max_colwidth to specify you want to see more in the default representation:

In [2]: df
Out[2]:
                                                 one
0                                                one
1                                                two
2  This is very long string very long string very...

In [3]: pd.options.display.max_colwidth
Out[3]: 50

In [4]: pd.options.display.max_colwidth = 100

In [5]: df
Out[5]:
                                                                               one
0                                                                              one
1                                                                              two
2  This is very long string very long string very long string veryvery long string

reference - Print very long string completely in pandas dataframe

Yoel Nisanov
  • 984
  • 7
  • 16
2

Is pandas.set_option not working? Try import pandas as pd; pd.set_option('max_colwidth', 800)

Look into pd.option_context as well if temporarily you need this width!

Partha Mandal
  • 1,391
  • 8
  • 14