mcabbott / mcabbott/AxisKeys.jl

Unable to use Tuples to label a KeyedArray

Open
#80 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
154
Forks
31
PR merge metrics
No merged PRs in 30d

Description

Trying to construct an array where the labels are stored in a tuple throws an error:

  MethodError: no method matching axes(::Tuple{Symbol, Symbol, Symbol}, ::Int64)
  Closest candidates are:
    axes(::Tuple) at tuple.jl:28
    axes(::TArray, ::Any...) at /home/lime/.julia/packages/Libtask/RQkfZ/src/tarray.jl:198
    axes(::DataFrames.GroupKey, ::Integer) at /home/lime/.julia/packages/DataFrames/vuMM8/src/groupeddataframe/groupeddataframe.jl:517

The code that generated this error --

table = KeyedArray(data; model=model_names, statistic=(:cv_diff, :se_cv_diff, :weight))

I'm guessing this is unintended, and the method is accidentally overtyped. If it's intentional, KeyedArray should probably be typed in such a way as to to avoid passing a tuple in the first place

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 KeyedArray construction shown in the issue with a tuple-valued statistic label and inspect the KeyedArray constructor or label-handling entry point. Trace why tuple labels reach axes(::Tuple, ::Int64), then verify that tuple labels work as intended without breaking existing label forms.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.