df3[10, :A] = missing
df3[15, :B] = missing
df3[15, :C] = missing
Even NA is not working.
I am getting an error
MethodError: Cannot
convert
an object of type Missings.Missing to an object of type Int64 This may have arisen from a call to the constructor Int64(...), since type constructors fall back to convert methods. Stacktrace: [1] setindex!(::Array{Int64,1}, ::Missings.Missing, ::Int64) at ./array.jl:583 [2] insert_single_entry!(::DataFrames.DataFrame, ::Missings.Missing, ::Int64, ::Symbol) at /home/jrun/.julia/v0.6/DataFrames/src/dataframe/dataframe.jl:361 [3] setindex!(::DataFrames.DataFrame, ::Missings.Missing, ::Int64, ::Symbol) at /home/jrun/.julia/v0.6/DataFrames/src/dataframe/dataframe.jl:448 [4] include_string(::String, ::String) at ./loading.jl:522
Use
allowmissing!
function.You can see which columns in a
DataFrame
allowmissing
because they are highlighted with⍰
after type name under column name.You can also use
allowmissing
function to create a newDataFrame
.Both functions optionally accept columns that are to be converted.
Finally there is a
disallowmissing
/disallowmissing!
pair that does the reverse (i.e. strips optionalMissing
union fromeltype
if a vector actually contains no missing values).