0

I'm working with a dataset containing, among other variables, gene names and TPMs.

Gene TPM
Gene A 0.2
Gene B 0.4
Gene A 2.1

I want to reduce any genes that occur more than once to one row and only report highest TPM for that gene, so that my table would now look like:

Gene TPM
Gene A 2.1
Gene B 0.4

I thought my solution would either be to filter my existing dataset or loop through the existing dataset row by row to record all genes and replace lower TPM values with higher ones found in the DF through iteration.

I am struggling to make either of these work and don't know if there is another solution which may work better.

Any help deeply appreciated.

Amanda
  • 5
  • 5
  • This is a duplicate of https://stackoverflow.com/questions/24558328/select-the-row-with-the-maximum-value-in-each-group Thanks – L Tyrone May 04 '23 at 22:34

0 Answers0