# numpy.amax () in Python

|

Parameters —

• arr: [array_like] input
• axis : axis [int or tuples of int] along which we want to get the maximum value. Otherwise, it will assume that arr will be flattened.
• from: [ndarray, optional] an alternative output array where to put the result
• keepdmis: [boolean, optional] if this parameter is set to True, the downsized axes remain in
the result as dimensions with size one. With this option, the result will translate correctly
the input array. If a default is passed, then keepdims will not be passed to all
ndarray subclasses, however any non-default will be. If the subclass sum method
does not implement keepdims, exceptions will be thrown.

Return — Maximum array — arr [ndarray or scalar], scalar if axis is None; The result is an array of dimensions a.ndim — 1 if axis is specified.

Code —

 ` # Python program illustrating ` ` # numpy.amax () method `   ` import ` ` numpy as geek `   ` # 1D array ` ` arr ` ` = ` ` geek.arange (` ` 8 ` `) ` ` print ` ` (` ` "arr:" ` `, arr) ` ` print ` ` (` ` " Max of arr: "` `, geek.amax (arr)) ` ` `  ` # 2D array ` ` arr ` ` = ` ` geek.arange (` ` 10 ` `). reshape (` ` 2 ` `, ` ` 5 ` ` ) ` ` print ` ` (` ` "arr:" ` `, arr) `   ` # Maximum smoothed array ` ` print ` ` (` ` "Max of arr, axis = None:" ` `, geek.amax (arr)) `   ` Maximum along the first axis ` ` # axis 0 means vertical ` ` print ` ` (` ` "Max of arr, axis = 0:" ` `, geek.amax (arr, axis ` ` = ` ` 0 ` `)) `   ` Second axis maximums ` ` # axis 1 means horizontal ` ` print ` ` (` ` "Max of arr, axis = 1: "` `, geek.amax (arr, axis ` ` = ` ` 1 ` `)) `

Exit —

` arr: [0 1 2 3 4 5 6 7] Max of arr: 7 arr: [[0 1 2 3 4] [5 6 7 8 9]] Max of arr, axis = None: 9 Max of arr, axis = 0: [5 6 7 8 9] Max of arr, axis = 1: [4 9] `

Note —
These codes will not work for online IDs. Please run them on your systems to see how they work

## Shop Learn programming in R: courses

\$ Best Python online courses for 2022

\$ Best laptop for Fortnite

\$ Best laptop for Excel

\$ Best laptop for Solidworks

\$ Best laptop for Roblox

\$ Best computer for crypto mining

\$ Best laptop for Sims 4

\$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

NUMPYNUMPY

How to convert Nonetype to int or string?

NUMPYNUMPY

How to specify multiple return types using type-hints

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

## Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method