Using Pandas to change Python display options


Pandas provides a very easy way to customize your Python display options. Even though it is not essential for data analysis, but it makes data exploration easy and gives you some more flexibility.

Most useful available parameters are:-

  1. display.max_rows :- This deals with the number of rows that can be displayed. If no. of rows exceeds this, you will see a truncated version.
  2. display.max_columns:- This deals with the maximum no of columns that can be displayed. If no of columns exceeds this, data frame will be displayed in a truncated manner.
  3.  display.precision:- It deals with the precision of decimal numbers.

Pandas also provide few functions which use these parameters. There are some default values for these parameters, which can be changed accordingly.

  1. get_option():- It returns the value for each parameters.
  2.  set_option():- It takes the parameter and a value as its argument and sets the value to the parameter.
  3.  reset_option() :- It sets the value of the specified argument back to the default value.
  4.  describe_option() :- It prints the description of the argument.

describe_option — Checking description of these parameters

get_option — finding out the default values for these parameters

set_option — Changing the default values

reset_option — resetting the values

These are some of the options available to play with your python interface. This is not a complete list and I will keep updating it. If there is any other function which you use regularly, then lets us know about it in the comment section.

Facebook Comments