For a research project, I need to process every individual's information from the website into an excel file. I have copied and pasted everything I need from the website onto a single column in an excel file, and I loaded that file using PANDAS. However, I need to present each individual's information horizontally instead of vertically like it is now. For example, this is what I have right now. I only have one column of unorganized data.
df= pd.read_csv("ior work.csv", encoding = "ISO-8859-1")
Data:
0 Andrew
1 School of Music
2 Music: Sound of the wind
3 Dr. Seuss
4 Dr.Sass
5 Michelle
6 School of Theatrics
7 Music: Voice
8 Dr. A
9 Dr. B
I want transpose every 5 lines to organize the data into this organizational format; the labels below are labels of the columns.
Name School Music Mentor1 Mentor2
What is the most efficient way to do this?
pd.DataFrame(df.values.reshape(-1, 5), columns=['Name','School','Music','Mentor1','Mentor2']))
– Gamaliel