I would like to know if there is a succinct way of combining rows that have the identical column values in pandas using a custom function.
import pandas as pd
data = {'Val': ['10uF', '10uF', '10uF', '1uF', '100nF'],
'Designator': ['C3', 'C4', 'C5', 'C6', 'C7'],
'Footprint': ['0805', '0805', '1206', '0805', '0805']}
data = pd.DataFrame.(data)
The resulting dataframe is:
Val Designator Footprint
0 10uF C3 0805
1 10uF C4 0805
2 10uF C5 1206
3 1uF C6 0805
4 100nF C7 0805
I want to combine rows such that there are only unique values in the Val column. In the Designator column of the combined rows there should be a custom value, the original designators separated by commas.
Expected output:
Val Designator Footprint
0 10uF C3,C4 0805
1 10uF C5 1206
2 1uF C6 0805
3 100nF C7 0805