Statistics.jl icon indicating copy to clipboard operation
Statistics.jl copied to clipboard

NaNs and quantile

Open diegozea opened this issue 8 years ago • 0 comments

Using DataFrames.describe over a dataset with NaNs gives an error, because quantiles throws an error when the input has at least one NaN.

DataFrames could manage that error using try, but maybe quantiles should return NaNs when there are NaNs in the input.

Related issue: https://github.com/JuliaLang/julia/issues/1142

julia> using RDatasets

julia> iris = dataset("datasets", "iris");

julia> iris[2,1] = NaN;

julia> describe(iris)
SepalLength
ERROR: ArgumentError: quantiles are undefined in presence of NaNs
 in quantile! at statistics.jl:545
 in quantile at statistics.jl:609
 in describe at /home/dzea/.julia/v0.4/DataFrames/src/abstractdataframe/abstractdataframe.jl:413
 in describe at /home/dzea/.julia/v0.4/DataFrames/src/abstractdataframe/abstractdataframe.jl:402
 in describe at /home/dzea/.julia/v0.4/DataFrames/src/abstractdataframe/abstractdataframe.jl:398

diegozea avatar May 25 '16 20:05 diegozea