JuliaArrays / JuliaArrays/AxisArrays.jl

sort(::AxisArray) does not sort labels

Open
#172 2 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

I was trying to use AxisArrays to tabulate counts of categories and was surprised that sort and sort! do not also sort the axis labels:

julia> A = AxisArray([1, 0], Axis{:cat}([:a, :b]));

julia> A[:a], A[:b]
(1, 0)

julia> sort!(A);

julia> A[:a], A[:b]
(0, 1)

What I would have expected was that after sorting, A[1] == A[:b] == 0 and A[2] == A[:a] == 1.

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

Reproduce the example in the issue, then inspect the sort(::AxisArray) and sort! entry points. Confirm how values and axis labels are reordered, and add coverage showing that sorting preserves the expected A[1], A[:b], and A[:a] relationships.

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.