Python Pandas – Expand data frame output

In this post we will be creating a Python script that will expand the viewing of a pandas data frame. By default data frames are abbreviated in output where there is too much to display.

A sensible option would be to output the data frame to a CSV, although if you do want more within the output you may utilize the built in Pandas options to customize global behaviour related to the display.

See the image below which depicts the pandas display in its default options.

By adding the snippet of code below to our script we can change our display option and have an extended range on screen.

pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)

Image example of what this looks like below.

Leave a Reply