I have a Dataframe like this:
| KeyA | KeyB | KeyC | KeyD | Field | Value |
|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | A | W |
| 1 | 2 | 3 | 4 | A | X |
| 1 | 2 | 3 | 4 | B | Y |
| 1 | 2 | 3 | 4 | B | Z |
| 1 | 2 | 3 | 5 | A | B |
How can i transform this Dataframe in a Dataframe like this so that the data is grouped by thefour key colmumns with a map of column Field as key and a List of the values.:
| KeyA | KeyB | KeyC | KeyD | Map (Key:String, Value: List) |
|---|---|---|---|---|
| 1 | 2 | 3 | 4 | A:W,X |
| 1 | 2 | 3 | 4 | B:Y,Z |
| 1 | 2 | 3 | 5 | A:B |
I would be very grateful for your help.