``````

In [1]:

import numpy as np

``````
``````

In [2]:

a = np.array([1, 100, 10])
print(a)

``````
``````

[  1 100  10]

``````
``````

In [3]:

print(np.argmax(a))

``````
``````

1

``````
``````

In [4]:

a = np.array([1, 10, 10])
print(a)

``````
``````

[ 1 10 10]

``````
``````

In [5]:

print(np.argmax(a))

``````
``````

1

``````
``````

In [6]:

a_2d = np.array([[20, 50, 30], [60, 40, 10]])
print(a_2d)

``````
``````

[[20 50 30]
[60 40 10]]

``````
``````

In [7]:

print(np.argmax(a_2d))

``````
``````

3

``````
``````

In [8]:

print(a_2d.flatten())

``````
``````

[20 50 30 60 40 10]

``````
``````

In [9]:

print(np.argmax(a_2d.flatten()))

``````
``````

3

``````
``````

In [10]:

print(np.argmax(a_2d, axis=0))

``````
``````

[1 0 0]

``````
``````

In [11]:

print(np.max(a_2d, axis=0))

``````
``````

[60 50 30]

``````
``````

In [12]:

print(np.argmax(a_2d, axis=1))

``````
``````

[1 0]

``````
``````

In [13]:

print(np.max(a_2d, axis=1))

``````
``````

[50 60]

``````
``````

In [14]:

idx = np.unravel_index(np.argmax(a_2d), a_2d.shape)
print(idx)

``````
``````

(1, 0)

``````
``````

In [15]:

print(a_2d[idx])

``````
``````

60

``````
``````

In [16]:

print(np.max(a_2d))

``````
``````

60

``````
``````

In [17]:

a = np.array([1, 100, 10])
print(a)

``````
``````

[  1 100  10]

``````
``````

In [18]:

print(a.argmax())

``````
``````

1

``````
``````

In [19]:

print(a.max())

``````
``````

100

``````
``````

In [20]:

a_2d = np.array([[20, 50, 30], [60, 40, 10]])
print(a_2d)

``````
``````

[[20 50 30]
[60 40 10]]

``````
``````

In [21]:

print(a_2d.argmax())

``````
``````

3

``````
``````

In [22]:

print(a_2d.argmax(axis=0))

``````
``````

[1 0 0]

``````
``````

In [23]:

print(a_2d.max(axis=0))

``````
``````

[60 50 30]

``````
``````

In [24]:

print(a_2d.argmax(axis=1))

``````
``````

[1 0]

``````
``````

In [25]:

print(a_2d.max(axis=1))

``````
``````

[50 60]

``````
``````

In [26]:

print(np.unravel_index(a_2d.argmax(), a_2d.shape))

``````
``````

(1, 0)

``````