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

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).

Do you want to show your product/service to 25000 data science enthusiasts every month? I am looking for companies which would like to become a partner of this blog.

Are you interested? Is your employer interested? Here are the details of the offer.

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)

Remember to share on social media!
If you like this text, please share it on Facebook/Twitter/LinkedIn/Reddit or other social media.

If you watch programming live streams, check out my YouTube channel.
You can also follow me on Twitter: @mikulskibartosz

If you want to hire me, send me a message on LinkedIn or Twitter.


If this article was helpful, consider donating to WWF or any other charity of your choice.
Bartosz Mikulski
Bartosz Mikulski * data scientist / software engineer * conference speaker * organizer of School of A.I. meetups in Poznań * co-founder of Software Craftsmanship Poznan & Poznan Scala User Group