How to Show All Columns and Rows in a Pandas DataFrame

When working with large datasets in Pandas, sometimes not all rows or columns are shown by default. This happens because Pandas limits the display to keep outputs readable. But if you want to see all columns and rows, here’s how you can do it:

Display All Columns

By default, Pandas truncates columns if there are too many. To show all columns, use:

import pandas as pd

pd.set_option(‘display.max_columns’, None)

 

This tells Pandas to display every column regardless of how many there are.

Display All Rows

Similarly, if your DataFrame has many rows, only a sample is shown. To see all rows, use:

pd.set_option(‘display.max_rows’, None)

 

This will print every row of the DataFrame.

Reset to Default

If you want to revert back to Pandas default display settings later, use:

pd.reset_option(‘display.max_columns’)

pd.reset_option(‘display.max_rows’)

 

Quick Example

 

import pandas as pd

 

# Create a large DataFrame

df = pd.DataFrame({

    ‘A’: range(1, 101),

    ‘B’: range(101, 201),

    ‘C’: range(201, 301)

})

 

# Show all rows and columns

pd.set_option(‘display.max_columns’, None)

pd.set_option(‘display.max_rows’, None)

 

print(df)

 

Summary

  • Use pd.set_option(‘display.max_columns’, None) to show all columns.

  • Use pd.set_option(‘display.max_rows’, None) to show all rows.

  • Useful when you want to inspect full data without truncation.