Missing not defined

Hi,

I have been using the following to replace missing values with zero but it’s now failing and I can’t see why.

replace!(df.myfloat64field, missing => 0.0)
returns
ERROR: UndefVarError: missing not defined

same problem when I try df = DataFrame(A=2,B=missing)

I’m using Julia 1.6.2 but I did try to upgrade to Julia 1.6.3 and 1.6.4 but the Language server gets stuck starting so I reverted. I have noticed strange problems in the past when I change versions. I tried adding Missings but no change. Do I need to do some sort of refresh or clearing of files when I change versions?

Thanks
Steve

All I can help with is letting you know it is supposed to work :slight_smile:

Version 1.6.3 (2021-09-23)
 
julia> using DataFrames

julia> df = DataFrame([[1,missing,3], [10,20,30]], ["a", "b"])
3×2 DataFrame
 Row │ a        b
     │ Int64?   Int64?
─────┼─────────────────
   1 │       1      10
   2 │ missing      20
   3 │       3      30

julia> replace!(df.a, missing => 0.0)
3-element Vector{Union{Missing, Int64}}:
 1
 0
 3

It may help to make the example more minimal. What happens if you restart Julia and just type

julia> missing

into the repl? And what is your full versioninfo() output? What if you type Base.missing?

2 Likes

Thanks DNF,

I changed my code to include your suggestion:

println("Base.missing ",Base.missing)
println("Verion Info ",versioninfo())
replace!(df_Value.Quantity, missing => 0)

and when I run the file using ^ F5 the output is

Base.missing missing
ERROR: LoadError: UndefVarError: versioninfo not defined

But from the repl I get

julia> versioninfo()
Julia Version 1.6.2
Commit 1b93d53fc4 (2021-07-14 15:36 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
  JULIA_HOME = C:\JuliaPro-1.3.1-2\Julia-1.3.1\bin
  JULIA_EDITOR = code
  JULIA_NUM_THREADS =

julia> Base.missing
missing

Thanks
Steve

Something seems to be seriously broken in your install: your Julia 1.6 uses JULIA_HOME = C:\JuliaPro-1.3.1-2\Julia-1.3.1\bin. I suggest removing that old JuliaPro version and reinstalling Julia from scratch.

3 Likes

Thanks, juliapro was previously removed but I uninstalled everything including the vscode extension and the Julia updater from the Microsoft store and re-installed 1.7.0 via direct download and it works as expected now. All versions after 1.6.2 were also failing to start the language server and that problem is also fixed. Thanks for your help.

1 Like