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

Integer strings as colnames/selectors are error prone #3428

Open
jariji opened this issue Mar 7, 2024 · 2 comments
Open

Integer strings as colnames/selectors are error prone #3428

jariji opened this issue Mar 7, 2024 · 2 comments
Labels

Comments

@jariji
Copy link
Contributor

jariji commented Mar 7, 2024

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
@bkamins
Copy link
Member

bkamins commented Mar 7, 2024

But what would you expect to be changed here? Essentially all "data frame" concept implementations allow selecting columns both by their number and their name.

@jariji
Copy link
Contributor Author

jariji commented Mar 7, 2024

Yeah it's not an easy problem. AxisKeys.jl's strategy is indexing by number with A[1,2] and by name with A(:foo, :bar).

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