Have you tried to create a new column and then sorting on that. I cannot comment on the original post, so i am just posting my solution.
df['c'] = df.a**2 + df.b**2df = df.sort_values('c')
Have you tried to create a new column and then sorting on that. I cannot comment on the original post, so i am just posting my solution.
df['c'] = df.a**2 + df.b**2df = df.sort_values('c')