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

Integer strings as colnames/selectors are error prone

Open jariji opened this issue 3 months ago • 2 comments

I don't know if anything can be done about this even in a breaking version but I think this is very error prone.

julia> let df = unstack(DataFrame(a=[2,1], x=["foo", "bar"]), :a, :x)
           df
       end
1×2 DataFrame
 Row │ 2        1       
     │ String?  String? 
─────┼──────────────────
   1 │ foo      bar


julia> transform(
           unstack(DataFrame(a=[2,1], x=["foo", "bar"]), :a, :x), 
           [2, 1] => ByRow(*), 
           ["2", "1"] => ByRow(*),
       )
1×4 DataFrame
 Row │ 2        1        1_2_*   2_1_*  
     │ String?  String?  String  String 
─────┼──────────────────────────────────
   1 │ foo      bar      barfoo  foobar

jariji avatar Mar 07 '24 01:03 jariji