我正在尝试将当前数据集的格式更改为每行 1 个用户的格式,并将“颜色”和“食物”列中的所有唯一值(动态数量的值)拆分为各自包含“是”和“否”的列。用户有一个唯一的ID。
Current format:
ID | Name | Color | Food
1 | John | Blue | Pizza
1 | John | Red | Pizza
1 | John | Yellow | Pizza
1 | John | Blue | Ice Cream
1 | John | Red | Ice Cream
1 | John | Yellow | Ice Cream
2 | Kelly | Blue | Pizza
2 | Kelly | Red | Pizza
Desired format:
ID | Name | Color_Blue | Color_Red …Run Code Online (Sandbox Code Playgroud)