I have a dataframe in pandas.
Group Value
1 12
1 0
1 1
1 8
2 4
2 5
2 8
3 8
3 9
3 4
I wish to scale the value for each group. Any idea how I can to apply the formula x_scaled = (x-min(x))/(max(x)-min(x)) to every group in the value column? My desired output is:
Group Value Scaled_Value
1 12 1
1 0 0
1 1 0.083333
1 8 0.666667
2 4 0
2 5 0.25
2 8 1
3 8 0.8
3 9 1
3 4 0