I have a dataframe with 3 columns: x, y, time. There are a few thousand rows.
What I want to do is retrieve the row with the minimum time but I would like that the minim
You don't need groupby at all. Here's an option with mask/where + loc + idxmin;
groupby
mask
where
loc
idxmin
df.loc[[df.time.mask(df.time.eq(0)).idxmin()]]
Or,
df.loc[[df.time.where(df.time.ne(0)).idxmin()]]
x y time 3 240 19 9.7