Skip to main content

Location of Missing Data

is_missing(input: any[] | Mat | Tensor) : any[] | Mat | Tensor

param input - the array, matrix, tensor, etc where you want to find the missing element

returns: any[] | Mat | Tensor - The same type and length/size as input, where element is 1 if missing, 0 if not.

This function effectively takes your input, which is a matrix, tensor or whatnot, and if it has a missing value in that entry it puts a '1' in it. If it is not a missing value, i.e. a valid or non-missing value, it is a '0'. So you get returned a matrix or tensor or whatever you put in input with 0's and 1's, where 1's represent missing elements and 0's otherwise.

Note that NaN, null, '', undefined are defined to be missing and [] and {} are not.

This is useful for getting an array where you know all the locations of the missing elements but not having an effect on them yet.