How to sort lists by column name

Hello everyone.

I’ve run into difficulties sorting lists by column name. The lists come from an excel file, which consists of several columns where each column is named after several variables e.g. “image_0_68_10h_1-13_sunny”. In each column, I have three corresponding rows of data.

I can easily extract one particular row from all columns and assemble this into a list:

However, I wish I could first sort and extract certain columns e.g. all those containing “sunny” or “image_1” in their column name.

I think the problem needs to be solved with python code but since I am not very strong in this it would be nice if someone could give a hint or help me where to start to solve the problem.

This is the script: (11.4 KB)

This is a .csv file w. my results. But I am working with the file in .xlsx format but I could not upload it in that format.
Results_example.csv (8.6 KB)

The data you posted isn’t like the image shown. You have a bunch of ; separated values

Yes. It is because I can only upload my excel sheet as a .csv file and not a .xlsx file.

You can internalize the data, forgoing the .csv upload

to internalize run it into a text component, right click internalize.

I’m thinking you isolate a branch, then use the sort component (zoom in to add more inputs for the 4 additional branches needed on teh sort component)

I am not sure that I understand your answer.

I have 143 branches and cannot use the sort component.

see attached (8.1 KB)

This is not exactly what I am asking.

My column names are text and not numbers and ranging them by size does not allow me to choose lists based on different combinations of column names.

You can be little more polite.

Sorry. I was not trying to be rude, I was just trying to explain exactly what it was I needed help with :slight_smile: But I think I found a solution now.

Internalize the data on your side before uploading your grasshopper script.
that will allow us to help you with your specific data set.

Just to encourage the OP, I found his comment strictly matter of fact, but not rude, just concise.

1 Like