I have the following snippet.
values = [[0.1, 0.7, 0.5], [0.6, 0.3, 0.2], [0.2, 0.8, 0.77]]
A = np.array(values).reshape(3,3)
print A.shape
print np.mean(A, axis=1)
B = np.mat(np.random.rand(3, 3));
print B.shape
print np.mean(B, axis=1)
Output of print statements:
(3, 3)
[ 0.43333333 0.36666667 0.59 ]
(3, 3)
[[ 0.47252016]
[ 0.44380355]
[ 0.51070646]]
I have two same shaped numpy array's with different values as an input, one is generated with the rand
function the other is a python list created with the array
function and calling reshape on it.
However, the shape of the mean return's a different shape for both, even though the input shapes are the same. Any Ideas what can cause this?