Choosing header or column labels

pandas will, by default, set the column names or header to the values from the first non-blank row in the Excel file. However, we can change this behavior. In the following screenshot, we are passing the value 3 to the header option, which tells the read_excel method to set the header names from index row 3:

df = pd.read_excel('IMDB.xlsx', sheetname=1, header=3)df.head()

The output of the preceding code is as follows:

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.