More examples of the axis keyword

Here, we use the drop method to drop a row or record. We tell the drop method to drop the record at the index of 0, by passing the keyword axis as 0:

data.drop(0, axis=0).head() 

The following is the output:

In the following example, we set axis to 1, which tells the drop method to drop the column with the Date label:

data.drop('Date', axis=1).head 

The following is the output:

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.