close
raw tf csv file
a,1,2,3,4 b,1,2,3,4 c,1,2,3,4 |
fname=ARGV[0] ary=[] File.open("#{fname}") { |content| while line=content.gets ary << line[0].to_s ary << line.split(',')[2..-1].map do |x| if (x.to_f>0) x = 1 else x = 0 end end puts ary.join(',') ary.clear end } |
全站熱搜