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

keys return LinearIndices #18

Open
theogf opened this issue Dec 15, 2021 · 1 comment
Open

keys return LinearIndices #18

theogf opened this issue Dec 15, 2021 · 1 comment

Comments

@theogf
Copy link
Contributor

theogf commented Dec 15, 2021

When calling keys on a TupleVector one gets

julia> x = TupleVector((;x=randn(10), y=randn(10)))
10-element TupleVector with schema (x = Float64, y = Float64)
(x = 0.1±1.1, y = 0.18±0.82)

julia> keys(x)
10-element LinearIndices{1, Tuple{Base.OneTo{Int64}}}:
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
julia> keys((;x=1, y=2))
(:x, :y)

when I would expect (:x, :y) I suppose?
Happy to make a PR if you agree that it should be the correct behaviour

@cscherrer
Copy link
Owner

I see what you mean here, my only concern is that TupleVector <: AbstractVector, and some people might expect generic methods to behave as they do for vectors. We should consider how this is handled in StructArrays.jl and DataFrames.jl. More generally, we could look at ArrayInterface.jl and Tables.jl and try to find some commonality -- nice if we could conform to both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants