Tables.jl
Tables.jl copied to clipboard
`columnnames` returns empty tuple on vector of namedtuples, but schema is correct
using Tables
tbl = map(rand(10), rand(10), ["abc" for I in 1:10]) do c1, c2, c3
(; c1, c2, c3)
end
Tables.istable(tbl) # true
Tables.columnnames(tbl) # ()
Tables.schema(tbl).names # (:c1, :c2, :c3)
# But
Tables.columntable(tbl) |> Tables.columnnames # (:c1, :c2, :c3)
Seems like a bug in the vector-of-namedtuples Tables.jl implementation potentially?
Just ran into this exact same thing - but it seems to be intentional? At any rate this is true for any rowtable. E.g.
tbl2 = broadcast(nt -> Dict(keys(nt) .=> values(nt)), tbl)
Tables.columnnames(tbl2)
also returns ()
But it definitely is a bit odd