lundi 12 mars 2018

How to compare numpy arrays ignoring nans?

I need to compare if two numpy arrays are equal to a desired precision ignoring nan values.
For example:

a = [1,nan,3,nan]  
b = [1,0.2,3,4.1]  

Should pass the test.
I have tried using numpy.all function but i understand that it expects two array identical and i need to have some tolerance because float values may differ a little.
How can i achieve this?

Aucun commentaire:

Enregistrer un commentaire