-1

Take an example: my metric is like this:

col1 col2 col3
1 4 7
2
6 9

How to count the proportion of NULL values in the above matrix?

winnie
  • 183
  • 1
  • 6

1 Answers1

0

The function count returns the number of non-null elements in a vector/matrix. And the function size returns the number of all the elements(NULL value included).

The example script is as follows:

matrix_test = matrix([1 2 NULL, 4 NULL 6], 7 NULL 9)
rate = 1-matrix_test.count()\matrix_test.size()
print(rate)

Running result: 0.333333333333333

dbaa9948
  • 189
  • 2
  • 10