Introduction to NumPy

What is NumPy?

NumPy is a module in python, stands for Numeric python. It is written in C, to make sure mathematical and numerical functions provide great execution speed. NumPy is a foundation of numeric in python.

NumPy is incredibly mature, They have 24 years of history with a long evolution.

Python is a general-purpose programming language. NumPy can make python a numeric Language.

How does it work?

NumPy deepens the programming language Python with powerful data structures by implementing multi-dimensional matrices. The implementation is even aiming at huge matrices and arrays.

What can we do by using this library?

  • Mathematical & logical operation
  • Linear Algebra
  • Matrix Computation
  • Numeric Analysis

What’s the difference?

We can also use the list provided by the Python core library.
The real difference is performance.

Pros of NumPy :

  • Consume less memory
  • Fast
  • Convenient to use

What is the structure of NumPy

A NumPy array is a grid of values, all of the same type, and is indexed by a tuple(columns) of non-negative integers.

It supports a much greater variety of numerical types than Python does.

By using various functions provided NumPy we perform many operations on ndarray like manipulation of value and more.

How to use NumPy in python code

For using numpy we need to import numpy and name as np so it will easier to write the code.
np.array() is used to create array.

import numpy as np                          #for importing numpy 
a=np.array([0,1,2,3,4], dtype='int16')      #creating array
print(a)

Output:-

[0 1 2 3 4]

Leave a Reply

Your email address will not be published. Required fields are marked *

Numpy Tutorials

NumPy : Print the entire large size array without wrapping

Study Machine Learning