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)

相关文章:

  • 2021-11-14
  • 2022-12-23
  • 2022-02-22
  • 2021-06-06
  • 2021-11-06
  • 2021-10-06
  • 2021-08-31
  • 2021-10-12
猜你喜欢
  • 2021-08-27
  • 2021-11-08
  • 2021-12-25
  • 2021-01-26
  • 2021-12-12
  • 2021-04-28
  • 2022-12-23
相关资源
相似解决方案