![]() |
VOOZH | about |
We can find out the mean of each row and column of 2d array using numpy with the function np.mean(). Here we have to provide the axis for finding mean.
Syntax: numpy.mean(arr, axis = None)
For Row mean: axis=1
For Column mean: axis=0
Example:
Output:
Mean of Row 1 is 2.0 Mean of Row 2 is 5.0 Mean of Row 3 is 8.0 Mean of column 1 is 4.0 Mean of column 2 is 5.0 Mean of column 3 is 6.0