Tables.jl
Tables.jl copied to clipboard
columnnames implementation for Tables.rowtable
In #247 it is observed that custom rowtables don't have a working fallback for Tables.columnnames. However, it appears that this is true for base rowtables as well:
julia> using Tables
julia> Tables.columnnames(Tables.rowtable([(a=1, b=2), (a=3, b=4)]))
()
I added this code to my project to get columnnames working for rowtables:
julia> Tables.columnnames(::Vector{NamedTuple{N, T}}) where {N, T} = N
julia> Tables.columnnames(Tables.rowtable([(a=1, b=2), (a=3, b=4)]))
(:a, :b)
Is there a reason why the default behavior is correct/preferred? If not I'll make a PR adding this columnnames definition and a test (doesn't solve the general case of #247 because table rows do not have to be NamedTuples).