如下所示:

import xlrd

import pandas as pd
from pandas import DataFrame
  
DATA_DIR = 'D:/'
 
excel_name = '%s2017.xls' % DATA_DIR
wb = xlrd.open_workbook(excel_name)
# print(wb)
  
# 获取workbook中所有的表格
sheets = wb.sheet_names()
# print(sheets)
  
# 循环遍历所有sheet
df_28 = DataFrame()
for i in range(len(sheets)):
 
# skiprows=2 忽略前两行
df = pd.read_excel(excel_name, sheet_name=i, skiprows=2, index=False, encoding='utf8')
df_28 = df_28.append(df)
 
# 去除缺省值
df_28 = df_28.dropna()
df_28 = df_28.reset_index(drop=True)
print(len(df_28))

相关文章:

  • 2021-12-29
  • 2021-08-08
  • 2022-01-15
  • 2021-05-22
  • 2022-12-23
  • 2021-04-01
  • 2021-11-23
猜你喜欢
  • 2021-12-04
  • 2021-12-13
  • 2021-12-04
  • 2021-12-03
  • 2022-01-31
  • 2022-01-16
相关资源
相似解决方案