1. Multiple sheets
Using Pandas to pd.read_excel() for multiple worksheets of the same workbook
- pd.read_excel() ⇒ read the first sheet of excel into a DataFrame
Using the ExcelFile object:
xls = pd.ExcelFile('excel_file_path.xls') xls.sheet_names # 获取各个 sheet 的名字 sheet_df = xls.parse(0)
Tricks: Read the sheet into a dictionary, indexed by sheet name:
sheet_map = {} for sheet_name in xls.sheet_names: sheet_map[sheet_name] = xls.parse(sheet_name)