import
numpy as np
# Working on 2D array
array
=
np.arange(
12
).reshape(
3
,
4
)
print
(
"INPUT ARRAY Values: \n"
, array)
# If No axis mentioned, so it works on entire array
print
(
"\nMax element : "
, np.argmax(array))
# returning Indices of the max element
# as per the indices
print
(
"\nIndices of Max element on column: "
, np.argmax(array, axis
=
0
))
print
(
"\nIndices of Max element on row: "
, np.argmax(array, axis
=
1
))
No comments:
Post a Comment