I’m trying to unstack a dataframe with missing values filled in as 0.
I followed exactly the example in the online documentation, but that example fails with the same error that I see in my code.
The following is copied exactly from the documentation: Functions · DataFrames.jl
ulia> df = DataFrame(id=["1", "1", "2"],
variable=["Var1", "Var2", "Var1"],
value=[1, 2, 3])
3×3 DataFrame
Row │ id variable value
│ String String Int64
─────┼─────────────────────────
1 │ 1 Var1 1
2 │ 1 Var2 2
3 │ 2 Var1 3
julia> unstack(df, :variable, :value, fill=0)
ERROR: MethodError: no method matching unstack(::DataFrame, ::Symbol, ::Symbol; fill=0)
Closest candidates are:
unstack(::AbstractDataFrame, ::Union{AbstractString, Signed, Symbol, Unsigned}, ::Union{AbstractString, Signed, Symbol, Unsigned}; renamecols, allowmissing, allowduplicates) at /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/DataFrames/vuMM8/src/abstractdataframe/reshape.jl:350 got unsupported keyword argument "fill"
unstack(::AbstractDataFrame, ::Any, ::Union{AbstractString, Signed, Symbol, Unsigned}, ::Union{AbstractString, Signed, Symbol, Unsigned}; renamecols, allowmissing, allowduplicates) at /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/DataFrames/vuMM8/src/abstractdataframe/reshape.jl:337 got unsupported keyword argument "fill"
unstack(::AbstractDataFrame; renamecols, allowmissing, allowduplicates) at /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/DataFrames/vuMM8/src/abstractdataframe/reshape.jl:361 got unsupported keyword argument "fill"
Stacktrace:
[1] kwerr(::NamedTuple{(:fill,), Tuple{Int64}}, ::Function, ::DataFrame, ::Symbol, ::Symbol)
@ Base ./error.jl:163
[2] top-level scope
@ REPL[75]:1