What is NumPy & why it is used?
NumPy is a Python library created in 2005 that
performs numerical calculations. It is used for working with arrays.It also
includes a wide range of mathematical functions,such as linear algebra,random
number generation etc, which can be applied to arrays.
NumPy is generally used for
1.Machine Learning
2.Data Science
3.Image and signal Processing
4.Scientific Computing
Getting Started With NumPy
In this Numpy tutorial, we will be using Jupyter
Notebook, which is an open-source web application that comes with built-in packages
and enables you to run code in real-time.
Let’s get started by importing our NumPy module and
writing basic code.
NumPy is usually imported under the np alias.
If NumPy is not installed, u can install through pip3/conda
commands.
The array object in NumPy is called ndarray which is
also called as N-Dimension array.
NDIM:
The ndim() attribute is used to find the dimensions of
the array.
DTYPE:
It is an attribute which can identify the data type of
given element
SHAPE:
This will return a tuple consisting of array dimensions.
It has been 2 dimensions, and each dimension contains
3 elements
SLICING:
It will extract the range of elements from the array.
Index starts from “0” in python
Random.rand():
This function generates random numbers from a uniform
distribution over the interval [0,1].
Random.randint():
This function generates random integers within a
specified range(low,high). Where low is inclusive and high is exclusive.
Comments
Post a Comment