# -*- coding: utf-8 -*-
import pandas
import os
def getScriptPath():
return os.path.split(os.path.realpath(__file__))[0]
writer = pandas.ExcelWriter(getScriptPath() + '/output.xlsx')
data = [['Alex', 10], ['Bob', 12], ['Clarke', 13]]
df = pandas.DataFrame(data, columns=['Name', 'Age'])
df.to_excel(writer, 'NameAndAge1')
df.to_excel(writer, 'NameAndAge2')
writer.save()
效果图
参考文章: