Python Answers

How to pretty-print an entire Python Pandas Series or DataFrame?

Spread the love

To pretty-print an entire Python Pandas Series or DataFram, we use the print method in the pd.option_context with statement.

For instance, we write

with pd.option_context('display.max_rows', None, 'display.max_columns', None):

to call pd.option_context to set some options for printing.

We make Pandas display all the rows and columns with display.max_rows and display.max_columns.

And then we call print with df to print the values of the series or data frame.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.