def multiple_dfs(file_name, sheet, *args):
"""
Put multiple dataframes into one xlsx sheet
"""
row=2
writer = pd.ExcelWriter(file_name, engine='openpyxl')
df = pd.DataFrame({'user': ['Bob', 'Jane', 'Alice'],
'income': [40000, 50000, 42000]})
df2 = pd.DataFrame({'amount': [100, 500, 1000],
'income': [40000, 50000, 42000]})
df3 = pd.DataFrame(['Title'])
df.to_excel(writer, sheet, startrow=row, index=False)
row += 2
df2.to_excel(writer, sheet, startrow=row, index=False)
df3.to_excel(writer, sheet, startrow=0, startcol=0, header=None, \
index=False)
I have the following error ValueError: DataFrame constructor not properly called!
, but I can't say what is the problem. Any suggestions?
I want to put a title at the top of a worksheet, but I don't know if it is the best practice. Could anyone be able to suggest me something with pandas?