I am given the two-dimensional arrays A and B. They are identical, but obtained with two different methods. Consider the following lines:
In [1]: (A==B).all()
Out [1]: True
In [2]: A.shape
Out [2]: (500, 10805)
In [3]: B.shape
Out [3]: (500, 10805)
In [4]: numpy.mean(A,axis=1)[0]
Out [4]: -0.006108739586784807
In [5]: numpy.mean(A[0,:])
Out [5]: -0.006108739586784786
In [6]: numpy.mean(B,axis=1)[0]
Out [6]: -0.006108739586784786
In [7]: numpy.mean(B[0,:])
Out [7]: -0.006108739586784786
As you can see, the result from line [4] differs from the results from lines [5], [6], and [7], but they should be identical. What is the reason for this?
The same problem occurs with numpy.sum() and numpy.std().