JuliaArrays / JuliaArrays/AxisArrays.jl

Select by axis values doesn't preserve the order

Open
#182 1 comment 3 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

When selecting an AxisArray by index, it returns the correct order as expected. However, if one selects by axis values, it doesn’t preserve the order (see example below).

julia> tmp = AxisArray(rand(2,3), x=[:a, :b], y=[:A, :B, :C])
2-dimensional AxisArray{Float64,2,...} with axes:
    :x, [:a, :b]
    :y, [:A, :B, :C]
And data, a 2×3 Array{Float64,2}:
 0.373003  0.355006  0.158701
 0.691354  0.277119  0.651728
julia> tmp[[2,1],:]
2-dimensional AxisArray{Float64,2,...} with axes:
    :x, [:b, :a]
    :y, [:A, :B, :C]
And data, a 2×3 Array{Float64,2}:
 0.691354  0.277119  0.651728
 0.373003  0.355006  0.158701
julia> tmp[[:b, :a],:]
2-dimensional AxisArray{Float64,2,...} with axes:
    :x, [:a, :b]
    :y, [:A, :B, :C]
And data, a 2×3 Array{Float64,2}:
 0.373003  0.355006  0.158701
 0.691354  0.277119  0.651728

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 by reproducing the Julia example from the issue, comparing index-based selection with selection by axis values. Trace the value-based indexing path and add or update coverage for a reversed request such as [:b, :a]; done means the returned axis values and data preserve the requested order.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.