Reputation: 11
Given the data above, I want to be able to name each excel sheet by the id. But the code only names sheet after last id.
Here is my code:
import pandas as pd
import xlsxwriter
df_dummy = pd.read_csv('dummy.csv')
id_store = df_dummy['id'].unique()
for i in id_store:
print (i)
workbook_dummy = xlsxwriter.Workbook('store_dummy.xlsx')
worksheet = workbook_dummy.add_worksheet('store {}'.format(i))
workbook_dummy.close()
Upvotes: 1
Views: 40