I have a dataframe with following columns
Name Company generic name generic name R&D Number (DC-) R&D Number (A) type
A AB 53654 5767 1111 3333 a
C CD 56767 56667
I would like to create a subset of this dataframe and combine columns with a pattern by aggregating the values by a ','
The desired output is:
Name Company generic name R&D Number
A AB 53654, 5767 1111, 3333
C CD 56767 56667
I found there is a way to filter the columns based on regex like below df.filter(regex=("R&D Number.*"))
But is there a way to join with the other columns and concatenate the value by ',' to get the final output. Any help is highly appreciated