-
Notifications
You must be signed in to change notification settings - Fork 54
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
Support setproperty as well to modify columns in place #11
Comments
Certainly something worth considering; it would definitely have to be optional, since a number of sources couldn't support this (CSV row-iterator, SQLite table row-iterator, etc.), but for those that could, it would certainly be handy. |
I don't think there's anything Tables.jl-specific here; if a custom Row type wants to support setproperty!, then there's nothing stopping them from doing so and documenting that it works. It isn't something the Tables.jl interface needs (or wants) to enforce though (NamedTuples already couldnt' support this). |
Maybe one thing that could be done on the Tables side is to add a function Base.setproperty!(c::ColumnsRow, nm::Symbol, x)
getproperty(getfield(c, 1), nm)[getfield(c, 2)] = x
end In this way it would be clear that all column based storage can have a |
With #131 merged, I'd like to commit to a simple, generic Tables.jl interface that is mainly about table transfer and consumption. I've proposed in another issue that it seems to make sense to get together and define a stricter interface that would support in-place and mutating operations. |
In the same way as Tables implements
getproperty
for a "lazy row" of aNamedTuple
of vectors here, I wonder whether it should also implementsetproperty!
. This is a nice bonus of using a lazy row rather than aNamedTuple
for iteration: we can get DataFramesMeta's@byrow!
for free. For example:The text was updated successfully, but these errors were encountered: