Select multiple sheets
So far, you've read Excel files one sheet at a time, which lets you customize import arguments for each sheet. But if an Excel file has some sheets that you want loaded with the same parameters, you can get them in one go by passing a list of their names or indices to read_excel()
's sheet_name
keyword. To get them all, pass None
. You'll practice both methods to get data from fcc_survey.xlsx
, which has multiple sheets of similarly-formatted data.
pandas
has been loaded as pd
.
This exercise is part of the course
Streamlined Data Ingestion with pandas
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Load both the 2016 and 2017 sheets by name
all_survey_data = pd.read_excel("fcc_survey.xlsx",
____)
# View the data type of all_survey_data
print(type(all_survey_data))