Options & Settings

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

This page targets pandas 3.1 (released on 2026-10-22) on Python 3.13 or 3.14 with NumPy 2.5, and was checked in October 2026. Every example was run on pandas 3.1.0. The options system is the one place where pandas keeps global state: a setting changes how every object in the process behaves, so this page also explains how to scope a change instead of leaving it on forever.

The functions and option names come from the official Options and settings guide and from pd.describe_option() in the installed version, which is the authoritative list for the version you actually run. The next pages cover the options that matter for speed (Enhancing Performance) and for reading big files (Scaling to Large Datasets). For the printed form of a frame, see DataFrame, and for the HTML and LaTeX output of tables see Table Styling.

The five functions

pandas exposes the whole options API at the top level, with five functions. All of them take a dotted option name such as display.max_rows.

Function What it does

pd.get_option(name)

Returns the current value.

pd.set_option(name, value)

Changes a value. Accepts several name and value pairs in one call. The value is validated against the option’s type.

pd.reset_option(name)

Restores the default. "all" resets every option, and a prefix such as "display" resets that group.

pd.describe_option(name)

Prints the description, valid values, default and current value. With no argument it prints every option.

pd.option_context(name, value, ...)

A context manager that sets one or more options and restores the previous values when the block ends, even if it raises.

The same options are reachable as attributes of pd.options, so pd.options.display.max_rows reads the option and assigning to it sets it.

import pandas as pd

pd.set_option("display.max_rows", 5)
print(pd.get_option("display.max_rows"))
print(pd.options.display.max_rows)       # attribute access reads the same option

pd.options.display.max_colwidth = 30     # attribute access also assigns
pd.reset_option("display.max_rows")      # one option back to its default
pd.reset_option("display")               # every option in the display group
print(pd.options.display.max_colwidth)

try:
    pd.get_option("display.max_col")     # matches max_columns and max_colwidth
except pd.errors.OptionError as exc:
    print("OptionError:", exc)

try:
    pd.set_option("display.max_rowz", 3)
except pd.errors.OptionError as exc:
    print("OptionError:", exc)

try:
    pd.set_option("display.precision", "x")
except ValueError as exc:
    print("ValueError:", exc)

pd.describe_option("display.precision")

Output:

5
5
50
OptionError: Pattern matched multiple keys
OptionError: No such keys(s): 'display.max_rowz'
ValueError: Value must be a nonnegative integer or None
display.precision : int
    Floating point output precision in terms of number of places after the
    decimal, for regular formatting as well as scientific notation. Similar
    to ``precision`` in :meth:`numpy.set_printoptions`.
    [default: 6] [currently: 6]

Three details from that run are worth remembering:

  • The option name is matched as a regular expression with re.search, and it must match exactly one option. display.max_col fails because two options start with it. The official guide warns that shorthand names may break when a later release adds a similar option, so write full names in code that has to keep working.

  • A misspelt name raises pd.errors.OptionError instead of silently creating a setting, and a value of the wrong type raises ValueError.

  • pd.reset_option("display") resets the entire display group, including options you set elsewhere in the program. Prefer resetting one named option, or use option_context so nothing needs resetting.

Scoping a change with option_context

Calling set_option at the top of a script is fine for a personal analysis. In library code, in a function that prints, or in a notebook cell that should not leak into the next one, use option_context. It restores the values when the block exits.

import numpy as np
import pandas as pd

rng = np.random.default_rng(0)
df = pd.DataFrame(
    rng.normal(size=(3, 12)),
    columns=[f"column_{i}" for i in range(12)],
)

print(df)                               # defaults: columns are elided with "..."

with pd.option_context("display.max_columns", None, "display.width", 200, "display.precision", 2):
    print(df)                           # every column, two decimals

print(pd.get_option("display.max_columns"))   # the context manager restored the old value

Output (the second table is one wide line in a terminal):

   column_0  column_1  column_2  ...  column_9  column_10  column_11
0  0.125730 -0.132105  0.640423  ... -1.265421  -0.623274   0.041326
1 -2.325031 -0.218792 -1.245911  ...  1.366463  -0.665195   0.351510
2  0.903470  0.094012 -0.743499  ...  0.540846   0.214659   0.355373

[3 rows x 12 columns]
   column_0  column_1  column_2  column_3  column_4  column_5  column_6  column_7  column_8  column_9  column_10  column_11
0      0.13     -0.13      0.64      0.10     -0.54      0.36      1.30      0.95     -0.70     -1.27      -0.62       0.04
1     -2.33     -0.22     -1.25     -0.73     -0.54     -0.32      0.41      1.04     -0.13      1.37      -0.67       0.35
2      0.90      0.09     -0.74     -0.92     -0.46      0.22     -1.01     -0.21     -0.16      0.54       0.21       0.36
0

The value 0 for display.max_columns is the default and means "detect the terminal width". Outside a real terminal (a script writing to a pipe, a test runner) there is nothing to detect, so the frame is elided as shown. Options are process-wide, not thread-local: two threads that enter option_context at the same time can see each other’s values, so do not rely on a context manager to isolate concurrent printing.

Display options

Display options change only how objects are rendered. They never change the data. These are the ones you will actually use.

Option Default Effect

display.max_rows

60

Above this many rows a frame is truncated in the repr. None means unlimited. 0 means auto-detect the terminal height.

display.min_rows

10

How many rows the truncated view shows. Only used when the frame exceeds max_rows.

display.max_columns

0

Above this many columns the repr elides the middle ones. None means unlimited. In a notebook, where the width cannot be detected, 0 behaves like 20.

display.width

80

Width in characters used when wrapping a wide frame.

display.expand_frame_repr

True

Wrap a wide frame over several blocks instead of eliding columns.

display.max_colwidth

50

Longest cell text shown before a trailing ellipsis. None shows everything.

display.large_repr

truncate

For a frame beyond the row or column limit, show a truncated table, or info to show the df.info() summary instead.

display.precision

6

Digits after the decimal point for floats.

display.float_format

None

A callable that turns a float into a string.

display.chop_threshold

None

Floats whose absolute value is below it print as 0.

display.colheader_justify

right

left or right alignment of column headers.

display.max_info_columns, display.max_info_rows

100, 1690785

Limits above which df.info() stops printing per-column detail or skips the non-null count (which is slow on huge frames).

display.max_seq_items

100

Longest list or index shown before ....

display.show_dimensions

truncate

Print the [rows x columns] footer: True, False or only when the repr is truncated.

display.memory_usage

True

Whether df.info() reports memory, and "deep" to inspect object contents.

display.max_categories

8

Categories shown when printing a categorical.

display.unicode.east_asian_width

False

Measure double-width characters (CJK and most emoji) correctly when aligning columns. It has a performance cost.

display.html.table_schema

False

Publish a Table Schema representation for front ends that can render it.

The first two are the ones people reach for. A frame with more than max_rows rows prints min_rows of them, so raising max_rows alone to see a 100-row frame works, but raising min_rows without max_rows does nothing. Printing a million-row frame with max_rows set to None can freeze a notebook, which the option’s own description warns about.

For a quick look at a slice, df.head(n).to_string() or df.to_string(max_rows=...) is usually safer than changing a global.

Number formatting

Three options control how floats look. They change the display only: the stored values keep full precision, which is the same distinction as between print(df) and df.round(2).

import pandas as pd

s = pd.Series([1.23456789, 2.5, 1000.123456, 0.00001234])
print(s)

with pd.option_context("display.precision", 2):
    print(s)

with pd.option_context("display.float_format", "{:,.2f}".format):
    print(s)

with pd.option_context("display.float_format", lambda x: f"{x:.1e}"):
    print(s)

with pd.option_context("display.chop_threshold", 0.001):
    print(s)

print(s.round(2))                        # changes the values, not only the display

df = pd.DataFrame({"text": ["x" * 80]})
print(df)
with pd.option_context("display.max_colwidth", None):
    print(df)

Output:

0       1.234568
1       2.500000
2    1000.123456
3       0.000012
dtype: float64
0    1.23e+00
1    2.50e+00
2    1.00e+03
3    1.23e-05
dtype: float64
0       1.23
1       2.50
2   1,000.12
3       0.00
dtype: float64
0   1.2e+00
1   2.5e+00
2   1.0e+03
3   1.2e-05
dtype: float64
0       1.234568
1       2.500000
2    1000.123456
3       0.000000
dtype: float64
0       1.23
1       2.50
2    1000.12
3       0.00
dtype: float64
                                                text
0  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
                                                                               text
0  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Things to notice:

  • display.precision of 2 switched the whole column to scientific notation, because the smallest value would otherwise print as 0.00. pandas picks one format for the whole column. A float_format callable overrides that choice, at the price of printing 0.00 for the tiny value.

  • display.float_format accepts any callable that maps a float to a string. The "{:,.2f}".format form is a bound method, and a lambda works equally well. It applies to every float column, not just one.

  • chop_threshold changes the printed value of 1.234e-05 to 0.000000 but keeps the number. Use it to hide floating-point noise such as 1e-17 in a matrix print.

  • To format one column and not the others, convert it to strings in a copy, or use a Styler (see Table Styling) which has its own styler.format.* options.

The compute, mode, io and plotting groups

Beyond display, the option groups below change how pandas computes or reads. Some of them are the most consequential settings in the library, and several changed meaning in pandas 3.

Option Default Effect

compute.use_bottleneck

True

Use the Bottleneck library for some reductions when it is installed.

compute.use_numexpr

True

Use numexpr to speed up large arithmetic and comparisons when it is installed. See Enhancing Performance.

compute.use_numba

False

Make the numba engine the default for the methods that support engine="numba".

mode.max_threads

None

New in pandas 3.1. The most worker threads parallel operations such as read_csv on large files may use. None means the smaller of the CPU count and 6, further limited by CPU affinity and cgroup limits. 1 disables parallel execution.

mode.performance_warnings

True

Show or hide PerformanceWarning, for example when a MultiIndex lookup is slow because the index is not sorted.

mode.string_storage

auto

Storage behind the str dtype: python, pyarrow or auto, which picks PyArrow when it is installed.

io.parquet.engine

auto

Parquet engine used by read_parquet and to_parquet.

io.sql.engine

auto

SQL engine used by read_sql and to_sql.

io.excel.xlsx.reader, io.excel.xlsx.writer and the matching xls, xlsm, xlsb, ods options

auto

Excel engine per file format. calamine is accepted as a reader for all formats.

plotting.backend

matplotlib

The module that implements DataFrame.plot.

Source: Available options, and the descriptions printed by pd.describe_option() in pandas 3.1.0.

mode.max_threads is worth a measurement, because it is a good example of an option that changes speed without changing results. On the 300,000-row, 17-column CSV file used by Scaling to Large Datasets, the default C engine read the file in about 30 ms with the default thread count and about 85 ms with mode.max_threads set to 1 on one laptop. Treat the ratio as indicative: it depends on the CPU, the file and the columns.

import time
import pandas as pd

def clock(label, fn):
    t0 = time.perf_counter()
    out = fn()
    print(f"{label:<34}{(time.perf_counter() - t0) * 1000:8.0f} ms")
    return out

clock("read_csv, default threads", lambda: pd.read_csv("readings.csv"))
with pd.option_context("mode.max_threads", 1):
    clock("read_csv, mode.max_threads = 1", lambda: pd.read_csv("readings.csv"))

Set mode.max_threads to a small number when pandas runs inside a larger parallel job (a web server with several workers, a joblib or multiprocessing pool, a scikit-learn grid search) so that its threads do not compete with the outer parallelism.

Choosing the string storage

mode.string_storage decides what backs the default str dtype. It does not change the dtype name, only the memory layout and speed.

import pandas as pd

with pd.option_context("mode.string_storage", "python"):
    print(pd.Series(["a"]).array.dtype.storage)
with pd.option_context("mode.string_storage", "pyarrow"):
    print(pd.Series(["a"]).array.dtype.storage)

Output:

python
pyarrow

The str dtype and the separate "string" dtype with pd.NA are described on Text Data & the str Dtype.

Styler options

DataFrame.style has its own option group, styler.*. These affect only the HTML or LaTeX that a Styler renders, never the plain repr of the frame. They need the optional Jinja2 dependency.

import pandas as pd

df = pd.DataFrame({"price": [1234.5678, 0.5, 98765.4321], "name": ["a", None, "c"]})

pd.set_option("styler.format.precision", 1)
pd.set_option("styler.format.thousands", ",")
pd.set_option("styler.format.na_rep", "n/a")

html = df.style.to_html()
print("1,234.6" in html, "n/a" in html)
print(df)                                 # the plain repr ignores styler.* options
pd.reset_option("styler")

Output:

True True
        price name
0   1234.5678    a
1      0.5000  NaN
2  98765.4321    c

styler.render.max_elements (default 262144) caps how many data cells a Styler renders before it trims rows or columns, which prevents a browser from hanging on a huge table. styler.render.max_rows and styler.render.max_columns cap one dimension at a time.

Options that no longer do what old code expects

Options are where the pandas 3 migration is most visible, because older tutorials changed global settings to switch behaviour on or off. In pandas 3 several of those switches are gone or inert.

Older advice State in pandas 3.1 What to do

pd.options.mode.copy_on_write = True (in pandas 2.x notes)

Deprecated and has no effect. Copy-on-Write is always on. Setting it emits a Pandas4Warning and get_option still returns True. The option will be removed in pandas 4.0.

Delete the line. Read Copy-on-Write.

pd.options.mode.chained_assignment = None to silence SettingWithCopyWarning

Deprecated and has no effect. SettingWithCopyWarning was removed in 3.0 and chained assignment never writes through.

Rewrite the assignment as df.loc[mask, "a"] = 1.

pd.options.future.infer_string = True to opt in to the string dtype (2.x)

The str dtype is the default since 3.0. Reading future.infer_string still works and returns True, but it is deprecated and will be removed in 4.0, after which the str dtype cannot be disabled.

Remove the opt-in. Use pd.api.types.is_string_dtype instead of comparing a dtype with object.

mode.use_inf_as_na

Removed in 3.0.

Convert infinities explicitly with replace([np.inf, -np.inf], np.nan) before counting missing values.

future.no_silent_downcasting

Deprecated and has no effect.

Delete the line.

io.hdf.dropna_table

Deprecated.

Drop rows with dropna() before writing.

The script below shows what happens when old code sets these options. Reading a deprecated option emits a warning too, not only setting it.

import warnings

import pandas as pd

with warnings.catch_warnings(record=True) as caught:
    warnings.simplefilter("always")
    print(pd.get_option("future.infer_string"))   # True: the str dtype is the default
    pd.set_option("mode.copy_on_write", True)     # no effect, only a warning
    pd.set_option("mode.chained_assignment", None)
for w in caught:
    print(w.category.__name__, "-", str(w.message)[:90])

print(pd.get_option("mode.max_threads"))          # None means min(CPUs, 6)
print(pd.get_option("compute.use_numba"))         # False unless you opt in
print(pd.get_option("mode.performance_warnings"))

Output:

True
Pandas4Warning - The 'future.infer_string' option is deprecated and will be removed in pandas 4.0. Inferring str dtype for
Pandas4Warning - The 'mode.copy_on_write' option is deprecated. Copy-on-Write can no longer be disabled (it is always e
Pandas4Warning - The 'mode.chained_assignment' option is deprecated. It has had no effect since pandas 3.0,
None
False
True

The warning class is Pandas4Warning: it announces a change that will take effect in pandas 4.0. The deprecation policy is described on Installation & Versions. A test suite that turns warnings into errors with -W error will catch leftover option calls before an upgrade.

Setting options at startup

An option set inside a script lives for that process. To apply the same display settings to every interactive session, put the calls in an IPython startup script. A file such as ~/.ipython/profile_default/startup/00-pandas-options.py runs when IPython or a Jupyter kernel starts.

import pandas as pd

pd.set_option("display.max_columns", 30)
pd.set_option("display.width", 140)
pd.set_option("display.max_colwidth", 80)

Keep startup options purely cosmetic. Anything that changes results, such as compute.use_numba or an alternative plotting.backend, belongs in the project code, where a colleague or a CI job will see it. A notebook that depends on a hidden startup file prints differently on another machine, which is a reproducibility problem of the same kind described on Jupyter Notebooks & JupyterLab.

Practical guidance

  • Prefer option_context over set_option in functions and in shared notebook cells.

  • Use full option names. Partial regular expressions are a convenience for the prompt, not for code.

  • Changing display options never fixes a data problem. If a column looks wrong, inspect dtypes and the values, not the formatting.

  • Do not set an option to silence a warning from pandas 3. The removed options do nothing, so the warning stays or the behaviour is already fixed.

  • Keep a record of non-default options in notebooks that you share, as part of the environment description.

References