python - Was there a change in NumPy's asserts dealing with NaN -
i having troubles running code wrote year ago on older system (python 2.7 , belive numpy 1.6.1). built in lot of "assert_array_almost_equal" check running of program. far checked code comparing like
>>> np.testing.assert_array_almost_equal([1.0,1.0,np.nan], np.ones(3))
which wasn't aware of. clealy raises assertion error. however, since code worked fine on previous system, wondered whether changed in "assert_array_almost_equal" , ignored nans before.
i don't believe there have been changes lead behavior describing. documentation numpy 1.6.0 , 1.7.0 show same behavior:
>>> np.testing.assert_array_almost_equal([1.0,2.33333,np.nan], ... [1.0,2.33333, 5], decimal=5) <type 'exceptions.valueerror'>: valueerror: arrays not equal x: array([ 1. , 2.33333, nan]) y: array([ 1. , 2.33333, 5. ])
numpy 1.7.0 assert_array_almost_equal documentation
numpy 1.6.0 assert_array_almost_equal documentation
Comments
Post a Comment