-
Notifications
You must be signed in to change notification settings - Fork 373
Open
Description
When trying to stack a df where a column name is "variable", the stack command suggests to use "makeunique", but then this lead to an error:
julia> df = DataFrame(
foo = ["a","a","b"],
variable = ["a","a","a"],
v1 = [1,1.5,2],
v2 = [10,11.5,13.5]
)
3×4 DataFrame
Row │ foo variable v1 v2
│ String String Float64 Float64
─────┼────────────────────────────────────
1 │ a a 1.0 10.0
2 │ a a 1.5 11.5
3 │ b a 2.0 13.5
julia> stack(df)
ERROR: ArgumentError: Duplicate variable names: :variable. Pass makeunique=true to make them unique using a suffix automatically.
Stacktrace:
[1] make_unique!(names::Vector{Symbol}, src::Vector{Symbol}; makeunique::Bool)
julia> stack(df,makeunique=true)
ERROR: MethodError: no method matching stack(::DataFrame, ::Vector{Int64}, ::InvertedIndex{Vector{Int64}}; makeunique::Bool)
This error has been manually thrown, explicitly, so the method may exist but be intentionally marked as unimplemented.Likely the message should say instead to specify the column to host the values to stack with the keyword argument variable_name.