> ## Content Index
> Fetch the complete content index at: https://datascientyst.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to show all columns and rows in Pandas
- URL: https://datascientyst.com/pandas-show-all-columns-rows/
- Published: 2022-03-11T10:22:03.000Z
- Updated: 2022-10-28T06:14:54.000Z
- Author: John D K
- Tags: Display

Hi all, in this tutorial, we'll learn how to **show all columns and rows in Pandas**. The solutions described in the article worked in Jupyter Notebooks and for printing in Python.

## Setup

We'll use the following DataFrame from [Kaggle - IMDB 5000 Movie Dataset](https://www.kaggle.com/carolzhangdc/imdb-5000-movie-dataset?select=movie%5Fmetadata.csv&ref=datascientyst.com), which can be downloaded and read with Python/Pandas:

```python
import kaggle
import pandas as pd

kaggle.api.authenticate()
kaggle.api.dataset_download_file('carolzhangdc/imdb-5000-movie-dataset', file_name='movie_metadata.csv',  path='data/')

df = pd.read_csv('data/movie_metadata.csv.zip')

```

DataFrame output in JupyterLab limit the number of shown rows and columns:

![pandas-show-all-columns](https://datascientyst.com/content/images/2022/10/pandas-show-all-columns.webp)

On the image we can see all rows and columns displayed by removing default thresholds.

## Step 1: Pandas show all columns - max\_columns

By default Pandas will display only a limited number of columns. The limit depends on the usage. In this article you can learn more about the limits: [How to Show All Columns, Rows and Values in Pandas](https://softhints.com/pandas-display-all-columns-and-show-more-rows/?ref=datascientyst.com)

To **show all columns in Pandas** we can set the option: `pd.option_context` \- `display.max_columns` to None.

```python
with pd.option_context("display.max_columns", None):
    display(df)

```

This will show all columns in the current DataFrame.

`display.max_columns` is described as:

> In case Python/IPython is running in a terminal this is set to 0 by default and pandas will correctly auto-detect the width of the terminal and switch to a smaller format in case all columns would not fit vertically.

## Step 2: Pandas show all rows - max\_rows

Pandas will show the first and last rows if the number of the rows is bigger than the threshold. All the other rows will be hidden.

To **show all rows in Pandas** we can use option - `display.max_rows` equal to None or some other limit:

```python
with pd.option_context("display.max_rows", None):
    display(df)

```

The option `max_rows` is described as:

> This sets the maximum number of rows pandas should output when printing out various output. For example, this value determines whether the repr() for a DataFrame prints out fully or just a truncated or summary repr. ‘None’ value means unlimited.

×Be careful because showing or printing all rows/columns might cause performance issues in the browser. Even it can break the Jupyter Notebook. 

## Step 3: Pandas set column width - max\_colwidth

Values with length higher than 50 characters will be truncated when we print or display a big DataFrame.

To **show full column width in Pandas** we can use:

```python
with pd.option_context("display.max_colwidth", None):
    display(df)

```

×Note that option 

max_colwidth

 works also for columns containing sequences. 

Definition of `max_colwidth` is:

> The maximum width in characters of a column in the repr of a pandas data structure. When the column overflows, a “…” placeholder is embedded in the output. ‘None’ value means unlimited.

![pandas-show-all-columns-values](https://datascientyst.com/content/images/2022/03/pandas-show-all-columns-values.png)

## Step 4: Pandas show all columns and rows - pd.option\_context

Finally if you like to **show all rows, columns and values from a Pandas DataFrame** we can use the following code to stop Pandas from hiding rows, columns and values:

```python
import pandas as pd
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', None)
pd.set_option('display.max_colwidth', None)

```

This will be applied for the whole Jupyter Notebook or Python code. So be careful otherwise we may face issues.

## Conclusion

We saw how to **show all rows, columns and values in Pandas.** We've learned how to set options globally and for context.

If you like to learn more about Pandas display option please refer: [Pandas Options and settings](https://pandas.pydata.org/docs/user%5Fguide/options.html?ref=datascientyst.com)