I try to test if there is a missing value at a specific position of a dataframe obtained with the CSV package and I did not find the function to do that. Thank you for your help.
ismissing ought to be exported from DataFrames. If that’s not happening, you are probably using an out-of-date version of DataFrames. (What do you get when you do Pkg.status("DataFrames")? It should say 0.11.1).
Unfortunately in its current form the package manager is rather problematic, some sometimes some weird thing happens that can cause it to refuse to update. If this is the case, it should at least tell you what’s causing the problem when you do Pkg.update("DataFrames"). In the worst case scenario you can use git to pull the updated version manually.
@nalimilan, right now Missings seems to be re-exported from DataFrames. I do not need using Missings on DataFrames 0.11.1.
I did not load DataFrames package to save some precompilation time, but if I load it the function ismissing() is present. So it is strongly advised to load the package DataFrame when using CSV…
julia> using DataFrames
julia> ismissing(x[2, 4])
true
Yes, it’s typically a good idea to have whatever packages that you are planning on working with loaded. Note that DataFrames pre-compiles, so the compilation time should only be noticeable the first time you do using DataFrames. It should load quite fast on all subsequent imports.
Note also that since DataFrames re-exports Missings, if you do using DataFrames you do not need using Missings.
You’re testing the type for the whole column “Term”, which is not missing. If you want to test for the presence of missing values in a column, you can do
sum(ismissing.(df_courses[Symbol("Term")]))
That would give you the number of missing values.
You can also do:
sum(ismissing.(df_courses[Symbol("Term")])) != 0
and that will tell you if you have missing values in your column.
I don’t know if there’s a better way of doing this, but it works.