Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@caniszczyk
Created March 21, 2014 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caniszczyk/9691249 to your computer and use it in GitHub Desktop.
Save caniszczyk/9691249 to your computer and use it in GitHub Desktop.
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