Input DataFrame: rowsCount = 7, columnsCount = 5
nameagecityweightisHappy
firstNamelastName
AliceCooper15London54true
BobDylan45Dubai87true
CharlieDaniels20Moscownullfalse
CharlieChaplin40Milannulltrue
BobMarley30Tokyo68true
AliceWolf20null55false
CharlieByrd30Moscow90true

Step 1: Pivot
LondonDubaiMoscowMilanTokyonull
DataFrame 1 x 5DataFrame 1 x 5DataFrame 2 x 5DataFrame 1 x 5DataFrame 1 x 5DataFrame 1 x 5

Step 2: PivotGroupBy
firstNamecity
LondonnullDubaiTokyoMoscowMilan
AliceDataFrame 1 x 5DataFrame 1 x 5
BobDataFrame 1 x 5DataFrame 1 x 5
CharlieDataFrame 2 x 5DataFrame 1 x 5

Output DataFrame: rowsCount = 3, columnsCount = 2
firstNamecity
LondonnullDubaiTokyoMoscowMilan
Alice{ means: { age: 15.0, weight... }, ... }{ means: { age: 20.0, weight... }, ... }{ }{ }{ }{ }
Bob{ }{ }{ means: { age: 45.0, weight... }, ... }{ means: { age: 30.0, weight... }, ... }{ }{ }
Charlie{ }{ }{ }{ }{ means: { age: 25.0, weight... }, ... }{ means: { age: 40.0, weigh... }, s... }