JuliaArrays / JuliaArrays/AxisArrays.jl

Can AxisVector support push!/pop!/deleteat! ?

Open
#232 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
207
Forks
41
PR merge metrics
No merged PRs in 30d

Description

This seems currently not implemented (by also looking inside the library):

julia> a = AxisArray([1,2,3], [4,5,7])

julia> push!(a, 4, 8) # not sure actually how to do it
ERROR: MethodError: no method matching resize!(::AxisVector{Int64, Vector{Int64}, Tuple{Axis{:row, Vector{Int64}}}}, ::Int64)

Closest candidates are:
  resize!(::BitVector, ::Integer)
   @ Base bitarray.jl:814
  resize!(::Vector, ::Integer)
   @ Base array.jl:1312

Stacktrace:
 [1] _append!(a::AxisVector{Int64, Vector{Int64}, Tuple{Axis{:row, Vector{…}}}}, ::Base.HasLength, iter::Tuple{Int64, Int64})
   @ Base ./array.jl:1196
 [2] append!(a::AxisVector{Int64, Vector{Int64}, Tuple{Axis{:row, Vector{Int64}}}}, iter::Tuple{Int64, Int64})
   @ Base ./array.jl:1187
 [3] push!(::AxisVector{Int64, Vector{Int64}, Tuple{Axis{:row, Vector{Int64}}}}, ::Int64, ::Int64)
   @ Base ./array.jl:1188
 [4] top-level scope
   @ REPL[61]:1
Some type information was truncated. Use `show(err)` to see complete types.

Can these methods be supported?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the AxisVector implementation in the AxisArrays library and reproduce the push! example from the issue. Determine how push!, pop!, and deleteat! should update both values and axis metadata, then verify that these operations work for AxisVector without the resize! MethodError shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.