ruby sortby 3rd element in a multidimential array npot working properly
- by Steven
Hi,
I'm using ruby to sort an array where each element in the array is another array.
I have this:
Data = Data.SortBy { |Info| info[3] }
example data in this column:
3.1
2
5.65
-1
0.4
-9.43
-10.87
-2.3
It should sort this into:
5.65
3.1
2
0.4
-1
-2.3
-9.43
-10.87
But it comes out like this:
5.65
3.1
2
0.4
-1
-10.87
-2.3
-9.43
It's only comparing the first char of the float... not the whole number?