Open m-knopp opened 10 months ago
You have two options:
missingstring = nothing
CSV.read("myfancytable.csv", DataFrame, missingstring=nothing)
CSV.read("myfancytable.csv", DataFrame, types = Dict(:mystringcolumn => String))
I agree that it's a bit strange that
CSV.read("test.csv", DataFrame, missingstring = String[])
doesn't provide the same result as
CSV.read("test.csv", DataFrame, missingstring = nothing)
Hi,
I have a hard time understanding why empty Strings are interpreted as
missing
by default.missing
represents a value that exists, but we don't have access to. Why would we assume that with no semantic information about the data we are parsing?""
is not a missing value, it is just an empty String and should be treated as such.This is really awkward when you try further operations that fail because the type of a column is now
Union{Missing, String}
. Also I found thatCSV.read("myfancytable.csv", DataFrame, missingstring="")
does not replace the "missing" values with empty Strings, they are stillmissing
values.CSV.read("myfancytable.csv", DataFrame, missingstring="abc")
does not replace "missing" values withString("abc")
, but withnothing
values.My suggestion is to use
String("")
ornothing
as the default value for an empty table cell.