Reading data from an Excel file
To read data from an Excel file, you will need to use a different reader function from pandas. Generally, working with Excel files can be challenging since the file can contain formatted multi-line headers, merged header cells, and images. They may also contain multiple worksheets with custom names (labels). Therefore, it is vital that you always inspect the Excel file first. The most common scenario is reading from an Excel file that contains data partitioned into multiple sheets, which is the focus of this recipe.
In this recipe, you will be using the pandas.read_excel()
function and will examine the various parameters available to ensure the data is read properly as a DataFrame with a DatetimeIndex
for time series analysis. In addition, you will explore different options to read Excel files with multiple sheets.
Getting ready
To use pandas.read_excel()
, you will need to install an additional library for reading and writing Excel files. In the read_excel...