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

Sparse indexing fails when keys not unique #187

Open
cdeterman opened this issue Apr 23, 2018 · 0 comments
Open

Sparse indexing fails when keys not unique #187

cdeterman opened this issue Apr 23, 2018 · 0 comments

Comments

@cdeterman
Copy link

I have a table like the following

2-d NDSparse with 10 values (2 field named tuples):
A B │ C data
───────────┼───────────
"a1" "b3" │ "c1" 2
"a2" "b1" │ "c1" 2
"a3" "b2" │ "c3" 4
"a3" "b2" │ "c2" 3

I would like to index the table like the following

mytable["a1","b3"]

Which works fine, however, when I try to index on one of the keys pairs that is not unique I get the following error. Have I missed something, is this not allowed for non-unique keys, or is this a bug?

mytable["a3","b2"]

ERROR: KeyError: key ("a3", "b2") not found
Stacktrace:
[1] _getindex_scalar(::IndexedTables.NDSparse{NamedTuples._NT_T_data{String,Int64},Tuple{String,String},IndexedTables.Columns{Name
dTuples._NT_R_S{String,String},NamedTuples._NT_R_S{PooledArrays.PooledArray{String,UInt8,1,Array{UInt8,1}},PooledArrays.PooledArray
{String,UInt8,1,Array{UInt8,1}}}},IndexedTables.Columns{NamedTuples._NT_T_data{String,Int64},NamedTuples._NT_T_data{PooledArrays.Po
oledArray{String,UInt8,1,Array{UInt8,1}},Array{Int64,1}}}}, ::Tuple{String,String}) at C:\Users\y66534.julia\v0.6\IndexedTables\sr
c\indexing.jl:10
[2] getindex(::IndexedTables.NDSparse{NamedTuples._NT_T_data{String,Int64},Tuple{String,String},IndexedTables.Columns{NamedTuples.
_NT_R_S{String,String},NamedTuples._NT_R_S{PooledArrays.PooledArray{String,UInt8,1,Array{UInt8,1}},PooledArrays.PooledArray{String,
UInt8,1,Array{UInt8,1}}}},IndexedTables.Columns{NamedTuples._NT_T_data{String,Int64},NamedTuples._NT_T_data{PooledArrays.PooledArra
y{String,UInt8,1,Array{UInt8,1}},Array{Int64,1}}}}, ::String, ::String) at C:\Users\userid.julia\v0.6\IndexedTables\src\indexing.j
l:3
[3] eval(::Module, ::Any) at .\boot.jl:235
[4] eval(::Any) at .\boot.jl:234
[5] macro expansion at C:\Users\userid.julia\v0.6\Atom\src\repl.jl:118 [inlined]
[6] anonymous at .<missing>:?

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

1 participant