I have a pandas dataframe with rows representing an identifier and the columns representing a gene name. Some gene names have been duplicated, so there are multiple columns with the same name, however each row only has 1 result for 1 gene.
I want to 'merge' the columns with the same gene name, keeping any result in any of the identical columns.
I have attached an image of the .head() of the dataframe below.
So in the example of column name 'ACTN3 (rs1815739)' it would merge all 3 of the identical columns, and the resulting column would have all the entries in all of the rows. The entries in the rows are strings or NaNs.
I can extract all the columns for one specific gene using .loc(), and could maybe figure out a solution for that extracted data, but the dataset is very big and I am a bit over my head trying to do all the columns at once.