当前位置:   article > 正文

pandas+xlrd操作excel批量读写全体sheet_pandas xlrd sheet

pandas xlrd sheet
import pandas as pd
import xlrd
xlsfile = r'D:\workfile\uv\wind.xls'
book = xlrd.open_workbook(xlsfile) 
#xlrd用于获取每个sheet的sheetname  
#count = len(book.sheets())
with pd.ExcelWriter('newxls.xls') as writer:
    for sheet in book.sheets():
        print sheet.name
        df = pd.read_excel(xlsfile,sheet.name,index_col = None,na_values= ['9999'])
        df.to_excel(writer,sheet_name = sheet.name)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/209631?site
推荐阅读
相关标签
  

闽ICP备14008679号