Skip to content

columnnames returns empty tuple on vector of namedtuples, but schema is correct #368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
asinghvi17 opened this issue Apr 24, 2025 · 1 comment

Comments

@asinghvi17
Copy link

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?

@tiemvanderdeure
Copy link

tiemvanderdeure commented Apr 29, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants