I have specific case where I want to convert this df: print df
Schoolname Attribute Value
0 xyz School Safe 3.44
1 xyz School Cleanliness 2.34
2 xyz School Money 4.65
3 abc School Safe 4.40
4 abc School Cleanliness 4.50
5 abc School Money 4.90
6 lmn School Safe 2.34
7 lmn School Cleanliness 3.89
8 lmn School Money 4.65
Which i need to get in this format so that i can convert it to numpy array for linear regression modelling.
required_df:
Schoolname Safe Cleanliness Money
0 xyz School 3.44 2.34 4.65
1 abc School 4.40 4.50 4.90
2 lmn School 2.34 3.89 4.65
I know we need to do groupby('Schoolname') but unable to think after that to get rows name to become column label and corresponding values reflected in required_df.
I need in this format so that I can convert it to numpy array and give it to Linear Regression model as my X vector.