import pandas as pd
li=[['34','54','wd'],[23,43,55,'s']]
out=pd.ExcelWriter(r'C:\Users\Administrator\Desktop\out.xls')
df = pd.DataFrame(li)
df.to_excel(out)
out.save()
###############################################
from openpyxl import load_workbook
import pandas as pd
data = pd.read_excel('test1.xlsx', sheetname=0)
# col_data = list(data.ix[:, 5]) # 获取除表头外开始的第五列数据
row_data = list(data.ix[5,:]) # 获取除表头外开始的第五行数据
writer = pd.ExcelWriter( 'test2.xlsx', engine='openpyxl')
book = load_workbook('test2.xlsx')
writer.book = book
result = pd.DataFrame(row_data)
result.to_excel(writer,sheet_name=0, index=False)
writer.save()
联系客服