I am working to reduce the rows in my dataframe based on the values in the first rows. If the value in the first column of a row matches the value in the second row of the first, I want to add the data in the residual columns.
My dataframe looks like this:
position | length | height |
---|---|---|
1 | 5.5 | 0.0 |
1 | 0.0 | 2.1 |
2 | 4.1 | 0.0 |
2 | 0.0 | 3.5 |
My desired output is this:
position | length | height |
---|---|---|
1 | 5.5 | 2.1 |
2 | 4.1 | 3.5 |