The following is an MWE of a problem in which I wanted to replace some missing values for a specific set of observations in a DataFrame
. It works with =
, but not with the .=
.
Is this a bug? If not, can someone please clarify what is going on?
using DataFrames, Missings
df = DataFrame(wage = [0.0, missing, 10.0, 20.0])
df[ismissing.(df[:wage]), :wage] .= 0 # note the . before the =
find(ismissing, df[:wage]) # 2, still there
Cf with arrays, .=
works fine:
A = [0.0, missing, 10.0, 20.0]
A[ismissing.(A)] .= 0
A # OK
Versions:
julia> Pkg.status.(["DataFrames", "Missings"]);
- DataFrames 0.11.3
- Missings 0.2.4
julia> VERSION
v"0.6.2"