Difference between two numpy arrays in python

前端 未结 2 1974
悲哀的现实
悲哀的现实 2021-01-03 17:41

I have two arrays, for example:

array1=numpy.array([1.1, 2.2, 3.3])
array2=numpy.array([1, 2, 3])

How can I find the difference between the

2条回答
  •  迷失自我
    2021-01-03 18:23

    This is pretty simple with numpy, just subtract the arrays:

    diffs = array1 - array2
    

    I get:

    diffs == array([ 0.1,  0.2,  0.3])
    

提交回复
热议问题