Ruby group_by in array of arrays
fruits.group_by {|(fruit, day)| fruit }.map {|fruit, match| [fruit, match.count] }
fruits = [["apple", "Tue"], ["mango", "Mon"], ["apple", "Wed"], ["orange", "Tue"]]
fruits.group_by(&:first).map{|k,v| [k,v.size]}
# => [["apple", 2], ["mango", 1], ["orange", 1]]