require 'daru' df = Daru::DataFrame.from_csv '/home/sameer/github_repos/daru/spec/fixtures/music_data.tsv', col_sep: "\t" df.timestamp.map! { |ts| ts += "+5:30"} require 'date' df = df.map_rows do |row| row[:timestamp] = DateTime.strptime(row[:timestamp], '%Y-%m-%dT%H:%M:%SZ%z').to_time row end # Group by artist name and call 'size' to see the number of rows each artist populates. artists = df.group_by(:artname).size artists.max_index top_ten = artists.sort(ascending: false)[0..10] top_ten.plot type: :bar do |plt| plt.width 1120 plt.height 500 plt.legend true plt.rotate_x_label 20 end