Search code examples
pythonpython-3.xdataframejupyter-notebook

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:

Juputer Screenshot

How can I display all columns?


Solution

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