I have a dataframe like this:
well pad type
'1A22' 22 a1
'2A22' 22 a1
'4A23' 23 a2
I'd like to sort dataframe by 2 columns of pad and well, but the 2nd column(well) using the number before 'A', so I am doing like this for key for 2nd column, and I got an error. Thanks for your help
df=df.sort_values(by=['pad','well'],key=lambda x1,x2: (int(x1),int(x2.split('A')[0])),ascending=True)
TypeError: () missing 1 required positional argument: 'x2'