Comments (1)
I agree it would be nice to make this all work. Trying to recover what's actually going on first, this works:
a = AcceleratedArrays.Interval(sd, ed)
A(in(a), :) # in(...) isa Function, so this goes to:
findall(in(a), dates) # isa StepRange, could be UnitRange
but without the in
it gets treated as a scalar, which fails:
a |> typeof |> supertype # , isn't anything recognised
AxisKeys.findindex(a, axiskeys(A,1)) # error, from this:
findfirst(isequal(a), axiskeys(A,1))
For IntervalSets.Interval
there's a special findindex
method to avoid this:
https://github.com/mcabbott/AxisKeys.jl/blob/master/src/selectors.jl#L6
It doesn't call findall(in(s), r)
, because that would be an error:
findall(in(IntervalSets.Interval(sd, ed)), dates.parent)
findall(in(IntervalSets.Interval(3,5.5)), 0:10) # same error without Dates
and instead falls back to giving a vector, as you observe. The issue to fix that is JuliaMath/IntervalSets.jl#52 (which should become a PR).
But it remains to figure out what to do with AcceleratedArrays.Interval
, without depending on that package. Why does this differ anyway, it's some issue about isless
vs <
? But it could still subtype AbstractInterval
, that would be nice because IntervalSets.jl is a small package for precisely this purpose.
Is there another way to catch this? We could send z::Any
to finall(in(z), axiskeys(A,1))
instead of findfirst(isequal(z), axiskeys(A,1))
, i.e. treat objects whose type doesn't match eltype of keys as collections, not individual values, but that doesn't seem ideal. For example push!(KeyedArray(rand(3), [:a, :b, :c]), 0.44)
has eltype Any
.
from axiskeys.jl.
Related Issues (20)
- wrapdims(::DataFrame) produces incorrect results when not all key combinations are present HOT 4
- Feature request: aggregation function for wrapdims (and populate!)
- Ambiguity error: ProjectTo(::KeyedArray(...)))((::NoTangent)) HOT 1
- `vcat`/`hcat`/`cat` bug at edge case with one `KeyedArray` HOT 2
- `getindex(::KeyedVector, ::Colon, ::Colon)` is broken
- Document `setkey!` in the README
- Error trying to `show` KeyedArray with undef values
- `ProjectTo` is too permissive? HOT 3
- Broadcasting ambiguity
- Interpolation
- isequal violates transitive property HOT 1
- Error in `LinearAlgebra.copy_oftype` on addition of symmetric `KeyedArray` and `UniformScaling` HOT 2
- `eachslice` fails on v1.9-beta2 HOT 1
- Feature request: `empty!`
- unsupported keyword argument "time" when taking a gradient with Zygote HOT 1
- Wrong FFT results
- Maybe update `LazyStack` so that this warning vanishes in Julia 1.9 HOT 1
- Slicing with larger key vectors is slow HOT 2
- Support for NaNStatistics HOT 2
- vcat / hcat is broken on julia 1.10 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from axiskeys.jl.