I have a 2D numpy array defined A, for example. I want to transform it into another 2D arrays according to the following statements:
B = A - mean(A), the mean by the second axis
C = B / mean(A)
An example:
>>> import numpy as np
>>> A = np.array([[1, 2, 3], [4, 6, 8]])
>>> A
array([[1, 2, 3],
[4, 6, 8]])
>>> M = np.mean(A, axis=1)
>>> M
array([ 2., 6.])
>>> B = ... # ???
>>> B
array([[-1., 0., 1.],
[-2., 0., 2.]])
>>> C = ... # ???
>>> C
array([[-0.5, 0., 0.5],
[-0.33333333, 0., 0.33333333]])