max columns pandas code example

Example 1: pandas show all rows

pd.set_option('display.max_columns', None)  # or 1000
pd.set_option('display.max_rows', None)  # or 1000
pd.set_option('display.max_colwidth', -1)  # or 199

Example 2: display maximum columns pandas

import pandas as pd
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)

Example 3: max of two columns pandas

df["C"] = df[["A", "B"]].max(axis=1)

Example 4: Display max number of columns pandas

pd.options.display.max_columns = 999
pd.options.display.max_rows = 999