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()
max_rows
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()
6
name class1 mark sex
id
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]
max_columns
We will read the value of max_columns and then set the value to 3
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]