How to display all columns of a Pandas DataFrame in Jupyter Notebook

Often, when we want to display the content of a Pandas dataframe in Jupyter Notebook, we end up with the result that fits on the screen but has some hidden columns. Isn’t it annoying? What do we do when it happens? I used to save the data frame to file and open it in Excel or select the one row I wanted to see and transpose the data frame to have all of the columns visible as rows (that works until you hit the limit of rows that can be displayed).

Fortunately, there is a better way. We can specify the maximum number of columns we want to see to some large value and get the friendly output in Jupyter without additional hassle.

1
pd.set_option('display.max_columns', 999)

Did you enjoy reading this article?
Would you like to learn more about software craft in data engineering and MLOps?

Subscribe to the newsletter or add this blog to your RSS reader (does anyone still use them?) to get a notification when I publish a new essay!

Newsletter

Do you enjoy reading my articles?
Subscribe to the newsletter if you don't want to miss the new content, business offers, and free training materials.

Bartosz Mikulski

Bartosz Mikulski

  • Data/MLOps engineer by day
  • DevRel/copywriter by night
  • Python and data engineering trainer
  • Conference speaker
  • Contributed a chapter to the book "97 Things Every Data Engineer Should Know"
  • Twitter: @mikulskibartosz
Newsletter

Do you enjoy reading my articles?
Subscribe to the newsletter if you don't want to miss the new content, business offers, and free training materials.