Hello all,
I am working on a small Python project and need some help.
I have a CSV file that is structured as follows:
Nr, Name, weight , height, with
112,Aerified, 41.70, 256.99, 141.01
656, Zoolab, 66.64, 108.44, 269.53
There are 10.000 randomly generated rows und the file.
Now I want to sort this file according to a selected column and output it.
For this I don't want to use methods but solve it with an algorithm.
For this I first imported it with pandas and then converted it to a list (hoping to be able to process it better):
I have already tried it with a bubble sort:
Do you have any other ideas?
I am working on a small Python project and need some help.
I have a CSV file that is structured as follows:
Nr, Name, weight , height, with
112,Aerified, 41.70, 256.99, 141.01
656, Zoolab, 66.64, 108.44, 269.53
There are 10.000 randomly generated rows und the file.
Now I want to sort this file according to a selected column and output it.
For this I don't want to use methods but solve it with an algorithm.
For this I first imported it with pandas and then converted it to a list (hoping to be able to process it better):
frame = pd.concat(li, axis=0, ignore_index=True) products_list = frame.values.tolist()That has also worked so far.
I have already tried it with a bubble sort:
def sort(product_list): for passnum in range(len(product_list)-1, 0, -1): for i in range(passnum): if int(product_list[i][2]) > int(product_list[i+1][2]): temp = product_list[i] product_list[i] = product_list[i+1] product_list[i+1] = temp return product_list print(sort(product_list))The I wanted to sort in this case after the 3rd column . But unfortunately it does not work.
Do you have any other ideas?