The numpy.amax() method returns the maximum of an array or maximum along the axis(if mentioned).
Syntax:
- Installing numpy etc. The easiest way to obtain numpy is via the Anacondas distribution. If you go here and follow the instructions at Anaconda for MacOS, you'll get numpy, scipy, pandas (and a set of other very useful scientific packages) installed on your system and automatically added to your PATH.
- Homebrew is a package manager for Mac OS X. Here's how to install it beforehand. Next, let's upgrade our default installation of Python to something greater than 2.7. Step 1 - Install Libraries Pip. Pip is a package manager for Python. Easyinstall pip.
![How to install numpy How to install numpy](/uploads/1/2/9/3/129381926/835507696.png)
NumPy Installation on Mac. Now, let’s try NumPy installation on a Mac OS. It is always suggestible to install it on Python 3 itself. Use the pip3 command in order to install NumPy. The usage of pip3 command is to specify your system that you are working on a Python 3 version. The below image helps you in the installation process.
Parameters –
- 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.
Code –
![Download Download](/uploads/1/2/9/3/129381926/427486449.jpg)
# numpy.amax() method import numpy as geek # 1D array print ( 'arr : ' , arr) arr = geek.arange( 10 ).reshape( 2 , 5 ) print ( 'nMax of arr, axis = None : ' , geek.amax(arr)) # Maxima along the first axis print ( 'Max of arr, axis = 0 : ' , geek.amax(arr, axis = 0 )) # Maxima along the second axis print ( 'Max of arr, axis = 1 : ' , geek.amax(arr, axis = 1 )) |
Output –
Reference –
https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.amax.html
https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.amax.html
Note –
These codes won’t run on online-ID. Please run them on your systems to explore the working
These codes won’t run on online-ID. Please run them on your systems to explore the working
Install Numpy Python 3.6
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 [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.
How To Numpy For Python 3.6 Machine Learning
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.