
正文
pandas 操作 excel
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
1. 多重 sheet
Using Pandas to pd.read_excel() for multiple worksheets of the same workbook
- pd.read_excel() ⇒ 将 excel 的第一个 sheet 读取到 DataFrame
使用 ExcelFile 对象:
xls = pd.ExcelFile('excel_file_path.xls')
xls.sheet_names # 获取各个 sheet 的名字
sheet_df = xls.parse(0)Tricks:将 sheet 读入到字典中,通过 sheet 名索引:
sheet_map = {}
for sheet_name in xls.sheet_names:
sheet_map[sheet_name] = xls.parse(sheet_name)






