If I've created a DataFrame df
, how can I save / export this to my cwd as a .csv file? How can I read it back in? The current ReadTheDocs link is broken.
Currently it's better to use the CSV.jl
package, it's simpler and more efficient in writing DataFrames
to files.
Assuming that you already imported the DataFrames
package and created the data frame df
:
using Pkg
Pkg.add("CSV")
using CSV
# for writing
CSV.write("outputfile.csv",df)
# for reading
new_df = CSV.read("outputfile.csv")
The default delimiter is ,
, but it's easily changed with :
CSV.write("outputfile.csv",df,delim='\t')
Note that delim
needs to be of type Char
and not type String
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With