Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Random Sampling of CSV in Ruby
require 'csv'
csvs = (1..13).map{|i| CSV.open("data#{i}.csv", "w")}
CSV.foreach("datagrants.csv") do |row|
puts row # TODO remove
csvs.sample << row
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.