I need help with realisation of the following logic: While grouping a DataFrame I want certain columns to be concatenated with another text. For example:
Input:
id | col1 | col2
---|------|------
1 | A | 12
1 | B | 43
---|------|-----
After applying something like
df.groupby(id).concatrows("text_"+col1+":"+col2.astype(str)),
the desired output should be:
id | new col
---|-----------------------
1 | text_A:12;text_B:43
---|-----------------------
So it should be kind of ";".join(), but with more flexibility.