hi I am using pytest for comparing the two columns of a dataframe by using below assert method
def test_compare():
np.testing.assert_almost_equal(v['col1'].values, v['col2'].values, decimal=4,verbose=True)
but the issue with this assert_almost_equal()
method is it while comparing col1 value i.e. 0.850341028331584 (upto 4 decimal places i.e. 0.8503) with col2 i.e. 0.850341028331585 (upto 4 decimal places i.e. 0.8503) it is throwing an error
> raise AssertionError(msg)
E AssertionError:
E Arrays are not almost equal to 4 decimals
E
E x and y nan location mismatch:
E x: array([0.8503, 0.1234, ..., 0.9028, 0.981 , 0.9789])
E y: array([0.8503, 0.1234, ..., 0.9028, 0.981 , 0.9789])
is there any workaround or some other assert function which compare strictly upto 4 decimal places only instead of round off.
Aucun commentaire:
Enregistrer un commentaire