I have a dataframe that looks like this:
Reference | ID | Length
ref101 |123456 | 10
ref101 |123789 | 5
ref202 |654321 | 20
ref202 |653212 | 40
I am trying to determine which row for each row in a column Referencehas the longest (based on the value in the column Length). For example, ref101with ID 123456longer lengths than ref101with ID 123789.
I played with .groupby(), but I'm not going anywhere. Is there any way to perform such an operation in Pandas?
source
share