# How to Configure Pandas Display Options to Show All Columns in Large Datasets

> Learn how to configure pandas display options to see all columns in large datasets. Prevent truncation and enhance your data analysis workflow by setting max_columns and width.

- Repository: [pandas/pandas](https://github.com/pandas-dev/pandas)
- Tags: best-practices
- Published: 2026-02-16

---

**Set `pd.set_option('display.max_columns', None)` and adjust `display.width` to prevent truncation and ensure all columns are visible when working with wide DataFrames in pandas.**

When analyzing large datasets in the pandas-dev/pandas repository, the default pandas display options often truncate wide DataFrames, hiding critical columns behind ellipses. Configuring these global settings allows you to view complete datasets without altering the underlying data structure, making exploratory data analysis more efficient.

## Understanding the Pandas Display Options Architecture

### The Configuration Registry (pandas/_config/config.py)

The global configuration system resides in [`pandas/_config/config.py`](https://github.com/pandas-dev/pandas/blob/main/pandas/_config/config.py), which implements the public API including `pd.get_option`, `pd.set_option`, `pd.reset_option`, and the context manager `pd.option_context`. This registry stores all display parameters that control how DataFrames render in the console.

### The Formatting Engine (pandas/io/formats/format.py)

When you print a DataFrame, the formatter in [`pandas/io/formats/format.py`](https://github.com/pandas-dev/pandas/blob/main/pandas/io/formats/format.py) queries the option `display.max_columns` via `get_option` to determine truncation thresholds. If the column count exceeds this limit, pandas inserts an ellipsis (`…`) to indicate hidden data.

## Essential Pandas Display Options for Large Datasets

### display.max_columns

The `display.max_columns` option controls the maximum number of columns shown before truncation. Set this to `None` to remove the limit entirely, or use a large integer (e.g., `1000`) for specific thresholds.

### display.width

The `display.width` option specifies the total character width of the console output. Setting this to `2000` or `None` prevents line-wrapping that could obscure columns in wide DataFrames.

### display.expand_frame_repr

When set to `True`, `display.expand_frame_repr` forces pandas to print DataFrames across multiple lines, making wide tables more readable in narrow terminals.

### display.max_rows (Optional)

While focusing on columns, you may also want to adjust `display.max_rows` to `None` or a large value to prevent vertical truncation when examining large dataset samples.

## Three Methods to Configure Pandas Display Options

### Global Configuration with set_option

Use `pd.set_option()` for session-wide settings that persist until changed or the Python process ends:

```python
import pandas as pd

# Configure to show all columns

pd.set_option("display.max_columns", None)
pd.set_option("display.width", 2000)
pd.set_option("display.expand_frame_repr", True)

# Create wide DataFrame

df = pd.DataFrame({f"col_{i}": range(5) for i in range(30)})
print(df)  # All 30 columns visible

```

### Temporary Configuration with option_context

The `pd.option_context()` context manager temporarily applies settings within a specific code block, ideal for Jupyter notebooks or shared scripts:

```python
import pandas as pd

df = pd.DataFrame({f"col_{i}": range(5) for i in range(50)})

with pd.option_context(
    "display.max_columns", None,
    "display.width", 2000,
    "display.expand_frame_repr", True
):
    print(df)  # Settings apply only here

# Outside the context, default settings resume

```

### Attribute-Style Access

For interactive exploration, use the `pd.options` attribute shortcut:

```python
import pandas as pd

# Equivalent to set_option calls

pd.options.display.max_columns = None
pd.options.display.width = 2000
pd.options.display.expand_frame_repr = True

```

## Summary

- **Set `display.max_columns` to `None`** in [`pandas/_config/config.py`](https://github.com/pandas-dev/pandas/blob/main/pandas/_config/config.py) via `pd.set_option()` to eliminate column truncation.
- **Increase `display.width`** to accommodate wide output without line-wrapping.
- **Use `pd.option_context()`** for temporary display adjustments that don't affect global settings.
- **Reference [`pandas/io/formats/format.py`](https://github.com/pandas-dev/pandas/blob/main/pandas/io/formats/format.py)** to understand how the formatter queries these options during DataFrame rendering.

## Frequently Asked Questions

### What is the default value for display.max_columns in Pandas?

By default, `display.max_columns` is set to `0` or `20` depending on your terminal width detection. When set to `0`, pandas attempts to detect the terminal width and adjust accordingly, often resulting in truncation of wide DataFrames.

### How do I reset pandas display options to default?

Use `pd.reset_option()` to restore defaults. For specific options, call `pd.reset_option("display.max_columns")`, or use `pd.reset_option("all")` to revert every configuration parameter to its initial state.

### Does setting display.max_columns to None affect performance?

Setting `display.max_columns` to `None` only affects the string representation and console output formatting. It does not impact DataFrame computation, memory usage, or analytical performance, as the underlying data remains unchanged.

### Can I save pandas display options configuration permanently?

Pandas does not persist display options between sessions by default. To maintain consistent settings, create a startup script or configure your IDE to execute `pd.set_option()` calls automatically when launching Python, or use a [`pandas_config.py`](https://github.com/pandas-dev/pandas/blob/main/pandas_config.py) module that you import at the start of each analysis.