Usage of the axis parameter

The axis parameter tells you a particular method, along with which axis of the DataFrame the method should be executed. The following code depicts the input datatype of the axis parameter:


The axis can be specified vertically or horizontally, or in other words, along rows or columns: use axis0 for rows and axis1 for columns, as shown in the following screenshot:

The following is the command:


Following is the output of the preceding command:

Get Mastering Exploratory Analysis with pandas now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.