Hi i'm a python beginner. I would like to extract different csv files from one big csv based on a value within a column. My csv looks like this:
IDMember Risk Area
1 2 30
2 1 20
3 2 10
I have thousands of value with the same IDMember
and i would like to extract one csv for each one of this ID, with the ID within the csv filename.
How can i do it?
i'm trying something like this, but i think i'm missing something:
import os
import pandas
df = r'MyCSVPath'
outFolder = r'MyOutputFolder'
col = 'MemberID'
for col in df.groupby('MemberID'):
df.to_csv(f'{MemberID}.csv')