Hi,
I wanted to change some rows of a DataFrame with a similar code to the following:
df = DataFrame([1:5,6:10])
df[df[:x1] .< 3 ,:x2] .= 99
julia> df
5×2 DataFrame
│ Row │ x1 │ x2 │
├─────┼────┼────┤
│ 1 │ 1 │ 6 │
│ 2 │ 2 │ 7 │
│ 3 │ 3 │ 8 │
│ 4 │ 4 │ 9 │
│ 5 │ 5 │ 10 │
But this did not change the value of the DataFrame. I had to remove the broadcasting operator for the assignment to change it.
df[df[:x1] .< 3 ,:x2] = 99
julia> df
5×2 DataFrame
│ Row │ x1 │ x2 │
├─────┼────┼────┤
│ 1 │ 1 │ 99 │
│ 2 │ 2 │ 99 │
│ 3 │ 3 │ 8 │
│ 4 │ 4 │ 9 │
│ 5 │ 5 │ 10 │
Why does the addition of the broadcast operator change the behavior? Because for Arrays, only the broadcasted assignments is not deprecated?
Thanks.