How to get average of rows, columns in a Numpy array

mean value Numpy array on a row or column

Panjeh
1 min readJun 22, 2020

To get the mean value, you first need to know that axis 1 is assumed as row and axis 0 is assumed as column.

a is an array, so:

np.mean(a, axis=0)

or

np.mean(a, axis=1)

depending on what axis you want to average on.

example:

--

--