1

As I now that numpy.ndarray.max using axis argument, it should return array of maximums over that axis. But I get results as if the axes are swapped.

import numpy as np

a = np.array([[1,5,50],[89,7,14]])

a.max(axis=0)
 array([89,  7, 50])

a.max(axis=1)
array([50, 89])

Isn't these results are swapped? Since when I use axis=0, I should get the maximums per row, and when using axis=1 I should get the maximums per column. However, the results are swapped here. how could that be?

1

1 Answer 1

0

The docs says:

If axis is an integer, then the operation is done over the given axis (for each 1-D subarray that can be created along the given axis).

so along the rows axis column vectors created and vice versa.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.