I have a dataframe like :
Country Name Income Group
1 Norway High income
2 Switzerland Middle income
3 Qatar Low income
4 Luxembourg Low income
5 Macao High income
6 India Middle income
i need something like:
High income Middle income Low income
1 Norway Switzerland Qatar
2 Macao India Luxembourg
I have used pivot tables : df= df.pivot(values='Country Name', index=None, columns='Income Group') and i get something like :
High income Middle income Low income
1 Norway none none
2 none Switzerland none
.
.
.
Can someone suggest a better solution than pivot here so that i don't have to deal with none values?