Skip to content
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

implement view(::DataFrame, ...) to support broadcasted assignment #1019

Closed
stevengj opened this issue Jul 22, 2016 · 3 comments
Closed

implement view(::DataFrame, ...) to support broadcasted assignment #1019

stevengj opened this issue Jul 22, 2016 · 3 comments

Comments

@stevengj
Copy link

In Julia 0.5, an assignment like a[i] .= ... gets converted by the parser to broadcast!(identity, view(a, i), ...), and moreover the broadcast! loop is automatically merged with broadcast loops from nested "dot" calls (see JuliaLang/julia#17510 and JuliaLang/julia#17546).

It would be nice to support this if a is a DataFrame. My understanding is that it will currently throw an error because view is not implemented for a DataFrame.

I haven't used DataFrames much, but if I understand it correctly then it sounds sufficient to define:

Base.view(a::DataFrame, key) = a[key]
Base.view(a::DataFrame, key, indices...) = view(a[key], indices...)
@nalimilan nalimilan added this to the 0.9.0 milestone Jan 25, 2017
@quinnj
Copy link
Member

quinnj commented Sep 7, 2017

Good up for grabs issue.

@stevengj
Copy link
Author

stevengj commented Sep 7, 2017

Actually, .= might work with dataframes in many cases already because broadcast! was updated to use a dotview function that defaults to getindex (so that it works as-is with things like dictionaries of array and in general anything where getindex can return a mutable object).

@nalimilan nalimilan modified the milestones: 0.9.0, 0.11 Sep 9, 2017
@nalimilan nalimilan modified the milestones: 0.11, 0.12 Nov 23, 2017
@nalimilan nalimilan changed the title implement view(::DataFrame, ...) for compatibility with .= in Julia 0.5 implement view(::DataFrame, ...) to support broadcasted assignment Sep 20, 2018
@nalimilan nalimilan removed this from the 0.12 milestone Oct 2, 2018
@bkamins
Copy link
Member

bkamins commented Jul 25, 2019

Done in 0.19.0 (+ some patching up pending in #1890)

@bkamins bkamins closed this as completed Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants