reshape data using python?

Viewed 37

being new to python I am looking for some help reshaping this data, already know how to do so in excel but want a python specific solution.

enter image description here

I want it to be in this format.

enter image description here

entire dataset is 70k rows with different vc_firm_names, any help would be great.

2 Answers

Assuming the original file is "original.csv", and you want to save it as "new.csv" I would do:

pd.read_csv("original.csv").groupby(by=["vc_firm_name"],as_index=False).aggregate(lambda x: ','.join(x)).to_csv("new.csv", index=False)
Related