Given a data frame that looks like this
GROUP VALUE 1 5 2 2 1 10 2 20 1 7
I would like to compute the differe
You can use groupby(), min(), and max():
groupby()
min()
max()
df.groupby('GROUP')['VALUE'].apply(lambda g: g.max() - g.min())