I have the following dataframe:
id val
1 10
1 2012
1 65
i want to convert the val column to create values that add up to 1
df['val'] = np.exp(df.val)/sum(np.exp(df.val))
but i get the following
id val
1 0.0
1 NaN
1 0.0
how can i take care of this to make probabilities equal to 1 for this case?