this is example of my code. i need to reorder the values to be more readable.
data = {'code 1':[123, 422 , 123, 868, 422],
'code 2':[53673, 3773, 387892, 17994, 2358]
'Company':['GRM', 'SER', 'MEM','NOE', 'SEE']
'Product_weight': [29,23,122,19,22]}
df = pd.DataFrame(data)
this is the actual table:
but i need it to be like this:
>Solution :
Try using sort_values:
df = df.sort_values('code 1')
Output:
>>> df
code 1 code 2 Company Product_weight
0 123 53673 GRM 29
2 123 387892 MEM 122
1 422 3773 SER 23
4 422 2358 SEE 22
3 868 17994 NOE 19

