Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV.write Cannot write Nothing #433

Closed
evveric opened this issue May 16, 2019 · 4 comments
Closed

CSV.write Cannot write Nothing #433

evveric opened this issue May 16, 2019 · 4 comments

Comments

@evveric
Copy link

evveric commented May 16, 2019

df = DataFrame(d=[nothing])
CSV.write(raw"c:\temp\t.txt", df)

This has error

@quinnj
Copy link
Member

quinnj commented May 16, 2019

Yeah, the question is what we should write/print for nothing. In Base, they made the decision that nothing shouldn't be printable. I think in the previous release, CSV.jl treated nothing like missing, so it just printed an empty field (or a provided null string). I guess we could go back to that behavior.

@quinnj
Copy link
Member

quinnj commented Jun 18, 2019

@nalimilan, @bkamins, do either of you have an opinion here? Should we just treat nothing like missing when writing out a csv file?

@nalimilan
Copy link
Member

nalimilan commented Jun 18, 2019

I guess it would make sense to provide an option to choose the string to use for nothing, as for missing. A simpler solution would be to print it as nothing, as it seems Base is going to switch to that soon anyway (JuliaLang/julia#32148).

At any rate, nothing and missing should probably not be printed the same way by default, as it would make a round-trip lose information.

@quinnj
Copy link
Member

quinnj commented Jul 10, 2019

Ok, I think I'd like to go with not supporting writing nothing in CSV files, with reasoning as follows:

  • CSV.jl isn't really in the business of supporting custom types, particularly on the parsing side; so in that respect, it makes sense, at least for the moment, to restrict parsing and writing to the known set of basic types (date, datetime, time, int, float, bool, string)
  • So this makes CSV.jl on the side of not being a "serialization" type package, and more of a dedicated "data format" package. That might change in the future, but for now, I think it makes sense and limits what we need to test/cover for

@quinnj quinnj closed this as completed Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants