I have data like below.
col1 col2
23 101
23 102
24 101
25 102
25 103
I want to pivot col2 based on col1. Desired output is like below.
col1 pro_1 pro_2 pro_3
23 101 102 NA
24 101 NA NA
25 NA 102 103
Tried like below:
data.pivot(data,columns=['col_1'],values=['col_2'])
I got an error like below:
ValueError: The name col_1 occurs multiple times, use a level number