I currently have a dataset that is structured like so:
ID ProgramCode ProgramType
001 0001 Major
001 0423 Minor
002 3203 Major
002 5893 Minor
I am trying to figure out the best way to use Pandas to Pivot the data to produce an output like:
ID ProgramCode_1 ProgramType_1 ProgramCode_2 ProgramType_2
001 0001 Major 0423 Minor
002 3203 Major 5893 Minor
I have tried various parameters using
df.pivot()
with no success.
Is there a better Pandas function to essentially search the DF for unique IDs and then fill in columns across a single row?