-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
Indexing into an axis array with an axis of eltype date using a range of eltype date as an index throws. I believe this is a bug.
julia> using AxisArrays, Test
julia> @testset for axis in [1:3, 'a':'c', Date(0):Day(1):Date(0,1,3)]
a = AxisArray(1:3, axis)
@test a[axis[1]] == 1
@test a[axis[2]] == 2
@test a[axis[3]] == 3
@test a[:] == 1:3
@test a[axis] == 1:3
end
Test Summary: | Pass Total Time
axis = 1:3 | 5 5 0.0s
Test Summary: | Pass Total Time
axis = 'a':1:'c' | 5 5 0.0s
axis = Date("0000-01-01"):Day(1):Date("0000-01-03"): Error During Test at REPL[136]:7
Test threw exception
Expression: a[axis] == 1:3
ArgumentError: unable to check bounds for indices of type Date
Stacktrace:
[1] checkindex(#unused#::Type{Bool}, inds::Base.OneTo{Int64}, i::Date)
@ Base ./abstractarray.jl:766
[2] checkindex
@ ./abstractarray.jl:773 [inlined]
[3] checkbounds
@ ./abstractarray.jl:694 [inlined]
[4] checkbounds
@ ./abstractarray.jl:709 [inlined]
[5] _getindex
@ ./multidimensional.jl:860 [inlined]
[6] getindex
@ ./abstractarray.jl:1294 [inlined]
[7] getindex_converted
@ ~/.julia/packages/AxisArrays/v7vf4/src/indexing.jl:133 [inlined]
[8] getindex(A::AxisArray{Int64, 1, UnitRange{Int64}, Tuple{Axis{:row, StepRange{Date, Day}}}}, idxs::StepRange{Date, Day})
@ AxisArrays ~/.julia/packages/AxisArrays/v7vf4/src/indexing.jl:123
[9] macro expansion
@ ~/.julia/dev/julia_master/usr/share/julia/stdlib/v1.9/Test/src/Test.jl:477 [inlined]
[10] macro expansion
@ ./REPL[136]:7 [inlined]
[11] top-level scope
@ ~/.julia/dev/julia_master/usr/share/julia/stdlib/v1.9/Test/src/Test.jl:1584 [inlined]
[12] top-level scope
@ ./REPL[136]:0
Test Summary: | Pass Error Total Time
axis = Date("0000-01-01"):Day(1):Date("0000-01-03") | 4 1 5 0.0s
Metadata
Metadata
Assignees
Labels
No labels