/config/pandas/display-max-columns
pandas display options: show all columns and rows (display.max_columns)
verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated 2026-10-20
- tool
- pandas
- file
- pandas options (pd.set_option)
- key
- display.max_columns / display.max_rows
- type
- int or None
- default
- check with pd.get_option; it was 0 (fit to the output width) when this page was verified, max_rows 60
pandas shortens what it prints: wide DataFrames get ... in the middle and long ones show only the first and last rows. pd.set_option("display.max_columns", None) shows every column, display.max_rows does the same for rows, and pd.option_context(...) changes them for a single block of code.
Before and after
python -c '
import pandas as pd
df = pd.DataFrame([[c for c in range(12)] for _ in range(2)], columns=[f"col{c}" for c in range(12)])
print("default max_columns:", pd.get_option("display.max_columns"))
pd.set_option("display.max_columns", 6)
print(df)
pd.set_option("display.max_columns", None)
pd.set_option("display.width", 200)
print(df)'Output
default max_columns: 0 col0 col1 col2 ... col9 col10 col11 0 0 1 2 ... 9 10 11 1 0 1 2 ... 9 10 11 [2 rows x 12 columns] col0 col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11 0 0 1 2 3 4 5 6 7 8 9 10 11 1 0 1 2 3 4 5 6 7 8 9 10 11
With a limit of 6, pandas shows the first and last three columns and a ... column in between; with None every column is printed.
Options you will use
| Option | What it controls | Show everything |
|---|---|---|
| display.max_columns | columns before truncating with ... | None |
| display.max_rows | rows before truncating | None |
| display.width | line width in characters | a large number, e.g. 400 |
| display.max_colwidth | characters per cell before ... | None |
| display.precision | decimal places for floats | — |
| display.float_format | function to format floats | '{:,.2f}'.format |
Set them once, or for one print
import pandas as pd
pd.set_option("display.max_columns", None) # for the whole session
pd.reset_option("display.max_columns") # back to the default
with pd.option_context("display.max_rows", None, "display.max_columns", None):
print(df) # only inside this blockSources
Related pages
cheat sheets · pandaspandas cheat sheet: read, select, filter, group and reshapepandas cheat sheet: read CSV and Parquet, select with loc and iloc, filter rows, add columns, group and aggregate, pivot, handle missing values and write files.commands · pandaspandas merge: join DataFrames on a key (inner, left, outer)pd.merge(left, right, on='id', how='left') joins DataFrames like SQL. how picks inner, left, right, outer or cross; validate= catches duplicated keys.compare · pandaspandas loc vs iloc: label-based vs position-based selectionloc selects rows and columns by label and includes the end of a slice; iloc selects by integer position and excludes it. Cases where they return different rows.