使用python处理excel表中多个sheet的数据时,可以使用xlrd
读取数据。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
import pandas as pd import xlrd from pandas import DataFrame
file = '临时表.xls'
wb = xlrd.open_workbook(file)
sheets = wb.sheets() df = DataFrame()
for i in range(10, len(sheets)): temp_df = pd.read_excel(file, sheet_name=i, header=1, index=False) dropna_df = temp_df.dropna(how='all')[:-2] df = df.append(dropna_df) df.head()
|
近期评论