Return rows with max/min values at bottom of dataframe (python/pandas)
Focus on the index values
And use one loc
i = df.col2.idxmin()df.loc[[*df.index] + [i]] col1 col2 col30 blue 2 dog1 orange 18 cat2 black 6 fish0 blue 2 dog
Same idea but with Numpy and iloc
i = np.arange(len(df))a = df.col2.to_numpy().argmin()df.iloc[np.append(i, a)] col1 col2 col30 blue 2 dog1 orange 18 cat2 black 6 fish0 blue 2 dog