here is the pandas code that i did to understand how it works for multiple columns. I thought, it sorts columns independently but it did not work like that.
df = pd.DataFrame({
'col1' : ['A', 'Z', 'E', np.nan, 'D', 'C','B'],
'col2' : [2, 1, 9, 8, 7, 4,10],
'col3': [0, 1, 9, 4, 2, 3,1],
'col4': [11,12,12,13,14,55,56], })
df_sort1= df.sort_values(by=['col1', 'col2','col3'])
df_sort2= df.sort_values(by=['col1'])
#this also return same result
#df.sort_values(by=['col1', 'col2','col3','col4'])
#df.sort_values(by=['col1', 'col2'])
output of the df_sort1 and df_sort2 is the same.
could someone explain please how it works? and what did I not understand here properly?
Thanks in advance.