Skip to content

Instantly share code, notes, and snippets.

@ohadle
Created October 11, 2016 13:05
Show Gist options
  • Save ohadle/8db6ac0162779a28266de5f5eab46736 to your computer and use it in GitHub Desktop.
Save ohadle/8db6ac0162779a28266de5f5eab46736 to your computer and use it in GitHub Desktop.
Process CSV
data = readcsv(joinpath(file_path, in_file); header=true)
map!(replace_nulls, data[1])
out_f = open(joinpath(file_path, out_file), "w")
write(out_f, join(data[2], ",")) #headers
writecsv(out_f, data[1][1:1, :]) #unclear why this is needed
writecsv(out_f, data[1])
close(out_f)
@ohadle
Copy link
Author

ohadle commented Oct 14, 2016

Added a newline char, now line 6 isn't needed:

data = readcsv(joinpath(file_path, in_file); header=true)
map!(replace_nulls, data[1])

out_f = open(joinpath(file_path, out_file), "w")
write(out_f, join(data[2], ",") * "\n")
writecsv(out_f, data[1])
close(out_f)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment