Submitted by : Omsingh Bais
Programming Tutorials: Python
Machine Learning : Numpy
Posted on : 2019-08-19
Introduction to Numpy
NumPy stands for "Numeric Python" or "Numerical Python" which is python package used for the computation and processing of the multidimensional and single dimensional array elements and also useful for linear algebra, Fourier transform, and random number operation.
Numpy become famous as an alternative to Matlab because Matlab is not an open source you have to purchase paid license version where as numpy is open source.
The combination of Numpy, Scipy, Matplotlib is used as the replacement of Matlab because python is much easier programming language than Matlab. So python it becomes the first choice for the data scientist.
Advantage of Numpy :
- Multidimensional arrays
- Scientific computation
- Fourier transforms & shapes manipulation.
- Element by element operations
- A method for processing array
- Easily interact with other python library.
Numpy installation :
Standard Python doesn't come with NumPy module. We have to install NumPy using popular Python package installer, pip. Execute the following command.
It is best practice to install NumPy with the SciPy. The binary distribution of the SciPy stack is specific to the operating systems.
For windows if we install Anaconda package Pandas,scipy will be installed by default.
- Download Anaconda(from here https://www.anaconda.com/ ) is a free Python packge for the SciPy .
- Download Canopy ( https://www.enthought.com/product/canopy/ ) and it's availble free.
In Linux, the different package managers are used to install the SciPy stack. Use follwing command to install the numpy.
$ sudo apt-get install python-numpy
$ python-scipy python-matplotlibipythonipythonnotebook python-pandas
$ python-sympy python-nose
To install NumPy, run the following command.
Python setup.py install
To check whether NumPy module is installed or not, import it from Python prompt.
If it is not installed, the following error message will be displayed.
Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> import numpy ImportError: No module named 'numpy'
- Please give your suggestion if you find anything incorrect. contact us at firstname.lastname@example.org