I can pass the StringIO object to pd.to_csv () just fine:
io = StringIO.StringIO() pd.DataFrame().to_csv(io)
But when using excel author, I have more problems.
io = StringIO.StringIO() writer = pd.ExcelWriter(io) pd.DataFrame().to_excel(writer,"sheet name") writer.save()
Returns
AttributeError: StringIO instance has no attribute 'rfind'
I am trying to create an ExcelWriter object without calling pd.ExcelWriter() , but I have some problems. This is what I have tried so far:
from xlsxwriter.workbook import Workbook writer = Workbook(io) pd.DataFrame().to_excel(writer,"sheet name") writer.save()
But now I get AttributeError: 'Workbook' object has no attribute 'write_cells'
How can I save pandas dataframe in excel format for StringIO object?
python pandas excel stringio xlsxwriter
A user
source share