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
}


創作者介紹
創作者 igogo 的頭像
igogo

牛大叔.生活隨筆

igogo 發表在 痞客邦 留言(0) 人氣()