# 需要事先安装
# pip install xlwt -i https://pypi.tuna.tsinghua.edu.cn/simple
writer = pandas.ExcelWriter('result.xls')
for flag, i in enumerate([result0_collection, result1_collection]):
i.to_excel(writer, sheet_name=str(flag))
# result0_collection result1_collection type was <class 'pandas.core.frame.DataFrame'>
writer.save()
writer.close()
###############################################################################
# 简易版保存数据方法
#all_data_reversetTo_dic 是保存数据的字典格式
all_data_reverseTo_dic = {'sentiments': [], 'content': [], }
pd.DataFrame(all_data_reverseTo_dic).to_excel(save_excel)
#如果是dataframe格式插入了新的一列数据那么需要这样保存
#insert(列的index,新列的名字,列的内容-务必保持和之前行数一样) original_dataframe.insert(len(original_dataframe.columns), 'result', test_Label)
original_dataframe.to_excel('final.xlsx')