'how to reduce dataFrame wisely
I want to transform the following dataFrmae structure where we have details regarding each id and kpi couple of records one with the value_left and the 2nd for the value_right I want to group the 2 records into a single record (as you see in the expected results)
i want to reduce the fillowing dataFrame
+---+---+----------+-----------+
| id|kpi|value_left|value_right|
+---+---+----------+-----------+
| 1|sum| 10| null|
| 1|sum| null| 20|
| 2|avg| 15| null|
| 2|avg| null| 15|
+---+---+----------+-----------+
Expected output dataFrame
+---+---+----------+-----------+
| id|kpi|value_left|value_right|
+---+---+----------+-----------+
| 1|sum| 10| 20|
| 2|avg| 15| 15|
+---+---+----------+-----------+
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
