💠

💠 2024-04-23 13:56:29


Offices文档

Word

Excel

Working with Excel Files in Python 参考: Python-Excel 模块哪家强?

大文件读取性能优化

  • 问题: pandas读取 200M+ Excel时会耗时很久(分钟级),思路将Excel转换为CSV再读取 Fast excel pythoncalamine性能最快且保留类型
    polars.read_excel读取Excel为DataFrame,同样使用calamine

Openpyxl
DuckDB
LibreOffice
Tablib


xlrd

1
2
3
4
5
6
7
8
9
    import xlrd 

    data = xlrd.open_workbook('monster.xlsx')
    table = data.sheets()[0]   
    nrows = table.nrows
    for i in range(nrows):
        for cell in table.row_values(i):
            print(cell, ' | ', end='')
        print()

Pandas