使用了pandas的to_excel方法,但每次都会覆盖原来的内容。请问还有什么方法可以将dataframe格式的数据导入到excel呢?
认证0级讲师
Choose one of two methods:
df.to_csv, parameter mode='a' means append
df.to_excel, put the df values together before writing. For example, the original data is df1, and the data to be written is df2then pandas.concat([df1, df2]).to_excel()
to_excel supports many parameters, among which:
startrow:upper left cell row to dump data framestartcol:upper left cell column to dump data frame
Before writing the excel file, first get the number of rows used in excel, and write the number of rows to start in to_excel
Choose one of two methods:
df.to_csv, parameter mode='a' means append
df.to_excel, put the df values together before writing. For example, the original data is df1, and the data to be written is df2
then pandas.concat([df1, df2]).to_excel()
to_excel supports many parameters, among which:
startrow:
upper left cell row to dump data frame
startcol:
upper left cell column to dump data frame
Before writing the excel file, first get the number of rows used in excel, and write the number of rows to start in to_excel