CSV data manipulation: Difference between revisions

m
Line 2,361:
 
=={{header|Julia}}==
<lang Julia>using DataFrames, CSV
Julia has rudimentary built-in support for csv input and output, which is certainly adequate for this task. More sophisticated support may be available with the <code>DataFrames</code> package.
 
<lang Julia>
ifn = "csv_data_manipulation_in.dat"
ofn = "csv_data_manipulation_out.dat"
 
ifiledf = openCSV.read(ifn, "r")
df.SUM = sum.(eachrow(df))
(a, h) = readcsv(ifile, Int, header=true)
CSV.write(ofn, df)
close(ifile)
</lang>{{out}}
 
a = hcat(a, sum(a, 2))
h = hcat(h, "SUM")
a = vcat(h, a)
 
ofile = open(ofn, "w")
writecsv(ofile, a)
close(ofile)
</lang>
 
{{out}}
<pre>
$ cat csv_data_manipulation_out.dat
4,102

edits