I have an array of arrays like so...
a1 = [[9, -1811.4], [8, 959.86], [7, -385], [6, -1731.39], [5, 806.78], [4, 2191.65]]
I need to get the average of the 2nd items(the amounts) from the total array.
So add -1811.4,959.86,-385,-1731.39,806.78 divided by the count (6)
I have tried...
a1.inject{ |month, amount| amount }.to_f / a1.size
This is not right and I cant see what I need to do