I have a data frame which looks as follows
df= pd.DataFrame(np.array([[1, 2, 3], [1, 5, 6], [1, 8, 9],[2, 18, 9],[3, 99, 10],[3, 0.3, 5],[2, 58, 78],[4, 8, 9]]),
columns=['id', 'point_A', 'point_B'])
Now I want to create column which is the sum of both point_A and point_B row . I can do that by this code: df["sum_of_all"] = df[["point_A","point_B"]].sum(axis = 1)
Now I want to give sort them based on sum_of_all. Meaning the most sum will be graded as 1 and so on. Now it has to be done based on id , How can I do that ?
Update :
Once I have finished the sum and sorting I get the above output. Now My goal is to assigne grade based on id. i.e : id 2 ,index 6, -> grade = 1,id 2 in index 3 -> grade 2 , id 3 on index 4 -> grade 1 and id 3 on index 5 -> 2 and so on
Thats the expection

