Option Settings

Learn how to adjust the settings of the advanced options in pandas.


We’ll take a deeper look at the advanced pandas functionalities, specifically option settings, which are sometimes overlooked. By adjusting these options, we can customize the way pandas operates to suit our specific needs.

The pandas library provides an API to customize global aspects of the behavior of DataFrames, and most of these options fall into the following three categories:

  • Display: Adjusting these settings lets us control how data structures are visually represented. For example, we can limit the number of rows displayed in the console, change the precision of floating-point numbers, or control whether some columns are truncated to the console.

  • Computation: Some options control the behavior of pandas in terms of computations. For example, the compute.use_bottleneck option, if set to True, can make operations like df.mean() run significantly faster for large datasets.

  • Mode: There are also mode options that control some aspects of computations and warnings in pandas. For instance, if we want to consider inf and -inf a null value in computations, we can set the mode.use_inf_as_na as True.

We can use the describe_option() function to view the full list of options, as shown below:

Get hands-on with 1200+ tech skills courses.