Let's say I have a dataframe
Category Data1 column1
A 'SOMEDATA' 10
A 'SOMEDATA' 2
A 'SOMEDATA' -10
B 'SOMEDATA' 10
B 'SOMEDATA' 1
B 'SOMEDATA' -10
and so on
I'd like to select a one row in each group by column value. For example, ABS(column1)
So resulting data is
Category Data1 column1
A 'SOMEDATA' 2
B 'SOMEDATA' 1
How can I do this in python?
I couldn't figure out how to return entire row. For example,
df.groupby('Category')['column1'].min();
this would only return 'Category' min(column1) only.