get_option() & set_option()

Pandas | All display functions

We can read display option values and update to different values by using get_option() and set_option()
get_option()Get the value of the input option.
set_option()Set the value for the input option
We will discuss some frequently used options here. You can get a list of available options by using describe_option()


While displaying rows of data from the Pandas DataFrame, there is a display setting to manage maximum number of rows to return ( display ). Default value is 60.
import pandas as pd
print(pd.get_option("display.max_rows")) # 60
Using set_option() we will change this value to 6.
After setting this value, we will check by using get_option()
print(pd.get_option("display.max_rows")) # 6
Let us read our student excel file ( you can download and use ) having 35 rows of data and display the rows after using set_option()
import pandas as pd 
my_data = pd.read_excel('D:\student.xlsx',index_col='id')
print(pd.get_option("display.max_rows")) # 6
          name class1  mark     sex
1     John Deo   Four    75  female
2     Max Ruin  Three    85    male
3       Arnold  Three    55    male
..         ...    ...   ...     ...
33   Kenn Rein    Six    96  female
34    Gain Toe  Seven    69    male
35  Rows Noump    Six    88  female

[35 rows x 4 columns]


We will read the value of max_columns and then set the value to 3
print(pd.get_option("display.max_columns")) # 20
          name  ...     sex
id              ...        
1     John Deo  ...  female
2     Max Ruin  ...    male
3       Arnold  ...    male
..         ...  ...     ...
33   Kenn Rein  ...  female
34    Gain Toe  ...    male
35  Rows Noump  ...  female

[35 rows x 4 columns]
Like this there are several options available and we can update the values of these function. A list of such options with detail description is available by using describe_option()
All display option functions of DataFrame

Pandas read_csv() read_excel() to_excel()

Post your comments , suggestion , error , requirements etc here

We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 All rights reserved worldwide Privacy Policy Disclaimer