Display all dataframe columns in a Jupyter Python Notebook
I want to show all columns in a dataframe in a Jupyter Notebook. Jupyter shows some of the columns and adds dots to the last columns like in the following picture:
How can I display all columns?
Try the display max_columns
setting as follows:
import pandas as pd
from IPython.display import display
df = pd.read_csv("some_data.csv")
pd.options.display.max_columns = None
display(df)
Or
pd.set_option('display.max_columns', None)
Pandas 0.11.0 backwards
This is deprecated but in versions of Pandas older than 0.11.0 the max_columns
setting is specified as follows:
pd.set_printoptions(max_columns=500)
I know this question is a little old but the following worked for me in a Jupyter Notebook running pandas 0.22.0 and Python 3:
import pandas as pd
pd.set_option('display.max_columns', <number of columns>)
You can do the same for the rows too:
pd.set_option('display.max_rows', <number of rows>)
This saves importing IPython, and there are more options in the pandas.set_option documentation: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.set_option.html