Skip to content
New issue

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

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

Already on GitHub? # to your account

columnnames sometimes returns property names #337

Open
ParadaCarleton opened this issue Jul 7, 2023 · 4 comments
Open

columnnames sometimes returns property names #337

ParadaCarleton opened this issue Jul 7, 2023 · 4 comments

Comments

@ParadaCarleton
Copy link

using CSV
data = CSV.load("filepath.csv")
Tables.columnnames(data)
# returns (:filename, :delim, :keywords)--property names--instead of column names
@bkamins
Copy link
Member

bkamins commented Jul 7, 2023

Indeed type returned by CSV.load seems to need to override the default return-value (or define getproperty differently)

@ParadaCarleton
Copy link
Author

ParadaCarleton commented Jul 7, 2023

Yep. Besides that, is the default (automatically return properties) a good default, or should it error for types that don't have a defined method?

@quinnj
Copy link
Member

quinnj commented Jul 10, 2023

The default has always been to return propertynames.

@juliohm
Copy link

juliohm commented Jan 27, 2025

The linked issue #338 is a good resource. The Tables.columnnames trait is only safe in the result of Tables.columns. The table itself doesn't store the names of columns. After playing with this design decision for a while, I think it makes sense. Specially because it is hard to introduce fallbacks in Tables.jl with a "catch-all" types dispatch (there is no parent type).

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

No branches or pull requests

4 participants