I have a pandas DataFrame like this:
Id Name Result
1 rating good
1 feedback ok
2 rating average
2 number 5
I want to pivot Name column value as new column name, and corresponding Result column as cell value after groupby Id column, for a given Id, if corresponding Name is absent, the cell value will be NaN. For each given Id, there is no duplicate in Name column. The result will be:
Id rating feedback number
1 good ok NaN
2 average NaN 5
If there are >10000 rows, how to do this transformation efficiently?