I have a numpy matrix A where the data is organised column-vector-vise i.e A[:,0] is the first data vector, A[:,1] is the second and so on
A
A[:,0]
A[:,1]
You can also use matrix instead of array. Then you won't need to reshape:
matrix
array
>>> A = np.matrix([[1,2,3], [4,5,6], [7,8,9], [10, 11, 12]]) >>> m = A.mean(axis=1) >>> A - m matrix([[-1., 0., 1.], [-1., 0., 1.], [-1., 0., 1.], [-1., 0., 1.]])