Python exercise · about 5 minutes · free
Broadcasting
Subtract each column's average from every row, in one line. Broadcasting stretches the smaller array to fit.
m.mean(axis=0) gives one mean per column (shape (4,)). m - that subtracts it from every row automatically: NumPy broadcasts the 1-D array across the rows.
Your quest: Set
centred to the score matrix with each match's (column's) average subtracted.Try it now Runs in your browser. No sign-in needed. Ctrl+Enter to run.
Hint
centred = m - m.mean(axis=0)Output appears here.