I have a pandas dataframe that I would like to pretty-print in full (it's ~90 rows) in a Jupyter notebook. I'd also like to display it without the index column, if possible. How can I do that?
Asked
Active
Viewed 1.2k times
6
-
Does this answer your question? [How do I expand the output display to see more columns of a pandas DataFrame?](https://stackoverflow.com/questions/11707586/how-do-i-expand-the-output-display-to-see-more-columns-of-a-pandas-dataframe). It covers rows and columns – Trenton McKinney Aug 03 '20 at 18:08
-
Thanks @TrentonMcKinney - it helps for showing the full dataframe, but what about _not_ displaying the index column? – TY Lim Aug 03 '20 at 18:09
-
I do not think removing the index is an option unless you're printing to the clipboard like `df.to_clipboard(sep='\\s+', index=False)` – Trenton McKinney Aug 03 '20 at 18:11
2 Answers
4
For pretty-printing without an index, I think the right approach is to call the display method for HTML (which is what jupyter does under the hood):
from IPython.display import HTML
HTML(df.to_html(index=False))
(Credit to Display pandas dataframe without index)
As others have suggested you can use pd.display_max_rows()
for the row count limitation.

user2428107
- 3,003
- 3
- 17
- 19
3
In pandas you can use this
pd.set_option("display.max_rows", None, "display.max_columns", None)
please use this.
Without index use additionally.
df.to_string(index=False)

Arunbh Yashaswi
- 163
- 7