Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack wrong makeunique suggestion #3487

Open
sylvaticus opened this issue Feb 6, 2025 · 1 comment
Open

stack wrong makeunique suggestion #3487

sylvaticus opened this issue Feb 6, 2025 · 1 comment
Labels
Milestone

Comments

@sylvaticus
Copy link
Contributor

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.

@bkamins
Copy link
Member

bkamins commented Feb 6, 2025

Agreed!

@bkamins bkamins added the feature label Feb 6, 2025
@bkamins bkamins added this to the patch milestone Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants