Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Julia : How to detect whether a given 2D array has missing columns?

Tags:

matrix

julia

Let

a = [1 missing;2 missing]

The second column contains all missing elements.

How to check whether a column contains all missing elements?

I tried

all(i -> missing == i,a)
a[:,2] .== missing

but not succeeded.

like image 265
Vinod Avatar asked Sep 06 '25 03:09

Vinod


1 Answers

I understand you want to check a specific column, then do:

julia> all(ismissing, view(a, :, 2))
true

if you want to check all columns then do:

julia> all.(ismissing, eachcol(a))
2-element BitVector:
 0
 1
like image 103
Bogumił Kamiński Avatar answered Sep 07 '25 21:09

Bogumił Kamiński