Python 读写 Excel 可以使用 Pandas,处理很方便。但如果要处理 Excel 的格式,还是需要 openpyxl 模块,旧的 xlrd 和 xlwt 模块可能支持不够丰富。...Pandas 读写 Excel 主要用到两个函数,下面分析一下 pandas.read_excel() 和 DataFrame.to_excel() 的参数,以便日后使用。...names:设置列名,必须是list类型,且长度和列数一致
names = [“Name”, “Number”, “Score”]
usecols:使用的行
usecols = range...(1, 3) # 使用 [1, 3) 行,不包括第 3 行
usecols = [4, 7] # 使用 4和7 行
skiprows:指定跳过的行数(不读取的行数)
shiprows = 4...# 跳过前 4 行,会把首行列名也跳过
skiprows = [1, 2, 4] # 跳过 1,2,4 行
skiprows = range(1, 10) # 跳过 [1,10) 行,不包括第10行