I have a Table that I’ve loaded from an external .csv file, and I’d like to sort the table rows by numeric values in a certain column.
However, when I run Table.sort() or Table.sortReverse(), it keeps giving me seemingly randomly sorted data. The table it produces is not sorted by the values in the specified column either ascending or descending, and I cannot find a pattern to the way Processing is sorting the data.
I thought that the issue might be that it’s interpreting the values in that column as a datatype other than integers, so I even tried creating my sorting Table by constructing it one .setInt() at a time (from the .csv file using a for loop). Still the same result, no rhyme or reason to what .sort() or .sortReverse() spit out.
Am I missing something obvious? I haven’t been able to find many resources online about Table.sort() malfunctions. If need be I can post my code, but it’s part of a much larger project…
Hi, welcome to the forum.
The best way really is to post a concise small working snippet of your code.
I know it’s a little more work, but that’s the way to get a fast solution.