Dataframes.jl: Question: How to omit quotemark for writetable?

Created on 4 Jun 2015  路  7Comments  路  Source: JuliaData/DataFrames.jl

I tried Char[] as with readtable but get an error and '' (two single quotes) is invalid in julia.

Most helpful comment

I have to say this is coming back as an "issue" in my daily life over and over again. Especially when providing csv files to people with limited computer skills. They complain a lot about quotemarks as apparently a lot of software packages cannot handle this properly..
Any chance omitting quotes can be an option still? :) --> under the disclaimer that if people wanna do this it is on their own to make sure it is save to use..

All 7 comments

Are you sure this is a thing you want to do? We don't support writing files without quotemarks because some DataFrames would generate corrupt data as a result.

Me personally I really would like this, but I can understand your argument.
Not a big deal if it is not there. Just wanted to check if I am missing it.

At first I was thinking to implement it, but it would make things too brittle in my mind. You can only do this safely if you promise that your data never contains the end-of-column delimiter or the end-of-row delimiter. A single string containing a \n kills your parser's ability to read back the file you just wrote out.

Obviously a judgment call, but I think a defensible one in the interest of safety.

I have to say this is coming back as an "issue" in my daily life over and over again. Especially when providing csv files to people with limited computer skills. They complain a lot about quotemarks as apparently a lot of software packages cannot handle this properly..
Any chance omitting quotes can be an option still? :) --> under the disclaimer that if people wanna do this it is on their own to make sure it is save to use..

Have a look at the CSV.jl package. It looks like the CSV support will use that at some point, instead of the current implementation. Better file an issue there.

I support this idea. I also need to get rid of quotemarks.

Another option is to use the FileIO.jl integration provided by CSVFiles.jl:
````julia
using DataFrames, FileIO

df = ... # Get your DataFrame

save("data.csv", df, quotechar=nothing)

Or you can use the pipe syntax

df |> save("data.csv", quotechar=nothing)
````

This will work with the more than a dozen table types that IterableTables.jl integrates, not just DataFrames.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bkamins picture bkamins  路  7Comments

tlienart picture tlienart  路  8Comments

xiaodaigh picture xiaodaigh  路  5Comments

jangorecki picture jangorecki  路  7Comments

bbrunaud picture bbrunaud  路  3Comments