# Fill option in dataframe unstack not recognized

**URL:** <https://discourse.julialang.org/t/fill-option-in-dataframe-unstack-not-recognized/82994>\
**Category:** General Usage\
**Tags:** dataframes\
**Created:** [June 19, 2022, 2:35am UTC](https://discourse.julialang.org/t/fill-option-in-dataframe-unstack-not-recognized/82994 "2022-06-19T02:35:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonjilla](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@jonjilla](https://discourse.julialang.org/u/jonjilla)\
**Post date:** [June 19, 2022, 2:35am UTC](https://discourse.julialang.org/t/fill-option-in-dataframe-unstack-not-recognized/82994/1 "2022-06-19T02:35:29Z")

</div>

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](https://dataframes.juliadata.org/stable/lib/functions/#DataFrames.unstack)

```julia
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

```

---

<div class="post-metadata">

**Author:** ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Post date:** [June 19, 2022, 6:12am UTC](https://discourse.julialang.org/t/fill-option-in-dataframe-unstack-not-recognized/82994/2 "2022-06-19T06:12:59Z")

</div>

You are using documentation for DataFrames.jl 1.3.4, while you have installed DataFrames.jl 1.2.2. Please update your installation to have `unstack` work as expected.

---

<div class="post-metadata">

**Author:** ![jonjilla](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@jonjilla](https://discourse.julialang.org/u/jonjilla)\
**Post date:** [June 19, 2022, 6:50am UTC](https://discourse.julialang.org/t/fill-option-in-dataframe-unstack-not-recognized/82994/3 "2022-06-19T06:50:02Z")

</div>

Thanks, I didn’t notice that I was using a different version.
