Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a data frame, with students ID and names and other information.
I have done a groupby on students ID, I need to create zip file(on student name) for each student and then zip them all.
I have the following code.
I can zip all the csvs, but how can I zip each individually first since thery are in a loop?

What I have tried:

groupby = df.groupby('stu_ID')
for n,g in groupby
csv=g.to_csv(index=false)
with open('{}{}.csv'.format(path,n),'w' as out_file:
out_file.write(csv)

shutil.make_archive('PATH','zip',
'PATH)
Posted
Updated 7-Nov-19 5:43am

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900