FunctionRacerProblemsRace

Teams Side by Side

HardpandasPython

people has columns name and team; names are all different. Return a DataFrame with one column per team, the team names in alphabetical order. Each column lists that team's names alphabetically from the top. Columns shorter than the longest one end with None.

Example 1

people {"name":["Kim","Abe","Zed","Lou","Bea","Moe"],"team":["red","blue","red","blue","red","green"]}
returns {"columns":["blue","green","red"],"rows":[["Abe","Moe","Bea"],["Lou",null,"Kim"],[null,null,"Zed"]]}

blue has Abe and Lou, green only Moe, red has Bea, Kim and Zed. The shorter columns are filled with None.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More pandas problems