The numpy.amax() method returns the maximum of an array or maximum along the axis(if mentioned).
numpy.amax(arr, axis = None, out = None, keepdims = <class numpy._globals._NoValue>)
- arr : [array_like] input data
- axis : [int or tuples of int] axis along which we want the max value. Otherwise, it will consider arr to be flattened.
- out : [ndarray, optional] alternative output array in which to place the result
- keepdmis : [boolean, optional] if this is set to True, the axes which are reduced are left in
the result as dimensions with size one. With this option, the result will broadcast correctly against
the input array. If the default value is passed, then keepdims will not be passed through to the all
method of sub-classes of ndarray, however any non-default value will be. If the sub-classes sum method
does not implement keepdims any exceptions will be raised.
Return – Maximum of array – arr[ndarray or scalar], scalar if axis is None; the result is an array of dimension a.ndim – 1, if axis is mentioned.
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]
These codes won’t run on online-ID. Please run them on your systems to explore the working
This article is contributed by Mohit Gupta_OMG 😀. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Important differences between Python 2.x and Python 3.x with examples
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Sort Python Dictionaries by Key or Value
- Python | Merge Python key values to list
- Reading Python File-Like Objects from C | Python
- Python | Add Logging to a Python Script
- Python | Add Logging to Python Libraries
- Python | Visualizing O(n) using Python
- Python | Index of Non-Zero elements in Python list
- Python | Convert list to Python array
- MySQL-Connector-Python module in Python
- Python - Read blob object in python using wand library
- Python | PRAW - Python Reddit API Wrapper
- twitter-text-python (ttp) module - Python
- Reusable piece of python functionality for wrapping arbitrary blocks of code : Python Context Managers
- Python program to check if the list contains three consecutive common numbers in Python
- Creating and updating PowerPoint Presentations in Python using python - pptx
- How to write an empty function in Python - pass statement?
- Operator Functions in Python | Set 2