app.rb
# I am making a transformation 
# on the raw data set because
# I don't know my data structures up front
I am making a transformation
on the raw data set because
I don't know my data structures up front
I am making a transformation on the raw data set because I don ' t know my data structures up front
def chart_data
	@data = File.new("./public/data/clean_train.csv", "r")
	@csv = CSV.new(@data, :headers => true, :converters => :all)
	@csv.to_a.map {|row| ret = row.to_hash;  ret.delete(ret.keys.first); ret.slice("Overall Qual","Year Built","Overall Cond", "SalePrice","Year Remod/Add", "Yr Sold") }.to_json
end
def chart_data @data = File . new ( "./public/data/clean_train.csv" , "r" ) @csv = CSV . new ( @data , :headers => true , :converters => :all ) @csv . to_a . map { | row | ret = row . to_hash ; ret . delete ( ret . keys . first ) ; ret . slice ( "Overall Qual" , "Year Built" , "Overall Cond" , "SalePrice" , "Year Remod/Add" , "Yr Sold" ) } . to_json end
I am making a transformation
on the raw data set because
I don't know my data structures up front
I am making a transformation on the raw data set because I don ' t know my data structures up front
# This is a a reference to the file so that it can be read # Initializes a CSV representation for Ruby # Parses the CSV to the @accounts_to_create array as JSON object