larray.Array.divnot0

Array.divnot0(other) Array[source]

Divide this array by other, but return 0.0 where other is 0.

Parameters
otherscalar or Array

What to divide by.

Returns
Array

Array divided by other, 0.0 where other is 0

Examples

>>> nat = Axis('nat=BE,FO')
>>> sex = Axis('sex=M,F')
>>> a = ndtest((nat, sex))
>>> a
nat\sex  M  F
     BE  0  1
     FO  2  3
>>> b = ndtest(sex)
>>> b
sex  M  F
     0  1
>>> a.divnot0(b)
nat\sex    M    F
     BE  0.0  1.0
     FO  0.0  3.0

Compare this to:

>>> a / b                                  
nat\sex    M    F
     BE  nan  1.0
     FO  inf  3.0