-
Notifications
You must be signed in to change notification settings - Fork 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
broadcasted setindex
not working as expected
#1507
Comments
Yes - in general whole |
I think it migth call for some breaking changes. As I was saying in the discourse thread, really |
Right. That is why I have stopped #1380 in spring to make sure we are consistent. There are also other cases to clean up (e.g. handling of binary indexing). In general this topic is complex and tricky so I did not want to rush. |
Yes, this will definitely be a bit tricky. I think we should try to get to it soon though as we don't want to bake in weird custom behavior for DataFrames long after the release of 1.0. |
I have started collecting up the target behavior in #1380. Next week I will try to clean it up and propose a consistent upgrade that is:
|
Another related thing which is annoying/inconsistent with the current behavior is that |
Another issue here:
|
I guess this was a design decision and the assignment you want should be done like this:
because your assignment has the following meaning now:
of course the question is if we want to keep this approach. And this change would be conflicting with:
which is expected to work columnwise. In general - as we now start treating |
I would vote to re-think this while we are re-thinking other set index methods. The automatic broadcasted
is strange and I would be surprised if many people use it. Maybe the rule should be that any section of a DataFrame of size Although |
Arguably
Yeah, why not.
Yes, it should be much slower, so that really shouldn't be recommended. |
We should probably also allow
Which should set the right columns by name |
Will do |
Broadcasting assignment is done in 0.19, so closing it. Some of the |
Currently if you do
df[idx, n] .= x
you will be doing a broadcasted assignment to a copy of the selected part of the dataframe. See this post on discourse.It seems to me that this should probably assign to the original dataframe, as most users would probably expect that behavior (I've been using Julia a couple of years now, and it was not immediately obvious to me what was happening here). Apparently this can be done by extending
Base.dotview
.If someone decides to take this on, it might also be worth thinking carefully about the broadcast behavior on DataFrames more generally, as I suspect there are a few other "gotchas" lurking.
The text was updated successfully, but these errors were encountered: