i have a requirement as below
dataframe
id code
R101,GTR001
R201,RTY987
R301,KIT158
R201,PLI564
R101,MJU098
R301,OUY579
There can be many codes per id (not only two).
The expected output should be as below.
id col1 col2 col3 col4 col5 col6
R101 GTR001 MJU098 null null null null
R201 null null RTY987 PLI564 null null
R301 null null null null KIT158 OUY579
Here columns for particular id depends on the number of codes assigned to that id, i.e. under col1 and col2 code for R101 should be populated, under col3 and col4 code for R201 should be populated and the same goes for remaining ids.
code, e.g.GTR001, be assigned to two or moreids?