Assign value in a column based on condition in other columns

Viewed 24

How to write a Python code to assign as "HMWS" all Peaks with RT [min] < "MPP" and as "LMWS" all Peaks with RT [min] > MPP? From here how to sum the %Area of all Peaks named "HMWS" for each Signal separately to return the Total %Area of HWMS Peaks and repeat for "LMWS"?

Signal Peak RT [min] %Area
DAD1E 1.782 8.35
DAD1E 1.883 17.72
FLD1A 1.93 25.79
DAD1E MPP 2.14 73.54
FLD1A MPP 2.19 73.71
DAD1E 2.765 0.17
FLD1A 2.81 0.33
DAD1E 3.14 0.23
FLD1A 3.23 0.18

Output example

Signal Peak RT [min] %Total Area
DAD1E HMWS 1.782 26.07
FLD1A HMWS 1.93 25.79
DAD1E MPP 2.14 73.54
FLD1A MPP 2.19 73.71
DAD1E LMWS 3.14 0.4
FLD1A LMWS 3.23 0.51
0 Answers
Related