Reputation: 3148
Have a numpy array which was created from pandas values.
It looks like this:
array([[ 230.1, 37.8, 69.2],
[ 44.5, 39.3, 45.1],
[ 17.2, 45.9, 69.3],
[ 151.5, 41.3, 58.5],
[ 180.8, 10.8, 58.4]])
How can I subtract the np.mean() of it from every single entry of this array?
Thanks in advance!
Upvotes: 0
Views: 72
Reputation: 42758
With -
:
a = array([[ 230.1, 37.8, 69.2],
[ 44.5, 39.3, 45.1],
[ 17.2, 45.9, 69.3],
[ 151.5, 41.3, 58.5],
[ 180.8, 10.8, 58.4]])
a -= a.mean()
Upvotes: 1