Open
Description
I had expected names
to work i.e.
julia> using AxisArrays
julia> A = AxisArray(reshape(1:15, 5, 3), Axis{:time}(.1:.1:0.5), Axis{:col}([:a, :b, :c]))
5×3 AxisArray{Int64,2,Base.ReshapedArray{Int64,2,UnitRange{Int64},Tuple{}},Tuple{Axis{:time,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}},Axis{:col,Array{Symbol,1}}}}:
1 6 11
2 7 12
3 8 13
4 9 14
5 10 15
julia> names(A)
# (:time, :col)
julia> names(A.axes)
# (:time, :col)
julia> names(A.axes[1])
# :time
but these all give MethodErrors -- I instead need to use AxisArrays.axisnames(A)
and AxisArrays.axisname(A.axes[1])
(and there is no AxisArrays.axisnames(A.axes)
).
The precedent for extending Base.names
comes from DataFrames.jl e.g.
julia> using DataFrames
julia> df = DataFrame(a = 1:5, b = 6:10)
5×2 DataFrame
│ Row │ a │ b │
│ │ Int64 │ Int64 │
├─────┼───────┼───────┤
│ 1 │ 1 │ 6 │
│ 2 │ 2 │ 7 │
│ 3 │ 3 │ 8 │
│ 4 │ 4 │ 9 │
│ 5 │ 5 │ 10 │
julia> names(df)
2-element Array{Symbol,1}:
:a
:b
Metadata
Metadata
Assignees
Labels
No labels