Option Settings
Learn how to adjust the settings of the advanced options in pandas.
We'll cover the following
Introduction
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, thecompute.use_bottleneck
option, if set toTrue
, can make operations likedf.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 considerinf
and-inf
a null value in computations, we can set themode.use_inf_as_na
asTrue
.
We can use the describe_option()
function to view the full list of options, as shown below:
Get hands-on with 1400+ tech skills courses.