-->

NumPy Basic Tutorials for Beginners to Advance with Handwritten Notes & Video Explanation

NumPy Introduction 

NumPy stands for Numerical Python.

  • NumPy is a library for scientific and numerical computing in python.
  • NumPy provides high performance multidimensional array object and for working with arrays.
  • Array is a collection of common type of data structures having elements with same data type.

Numpy, NumPy , Basic of NumPy
NumPy Basic

In this tutorial we are talking about the NumPy Basic. We are using Jupyter Notebook.

you can watch the below video, all the content of the article has been explain in the video with the practical.

NumPy's main object is the multi dimensional array.

It is a table of elements (usually numbers), all of the same type, indexed by a tuple of positive integers.

In NumPy, dimensions are called axes.

One Dimensional array example is given below:- 

One Dimensional Array in NumPy
One Dimensional Array

Two - Dimensional Array example is given below.


Two Dimensional Array in Numpy
Two Dimensional Array


Q. Why we should use NumPy array when we have python list?

we should use NumPy array because of the following reasons :- 

  1. Fast
  2. Convenient
  3. Less Memory

Q. How to Import NumPy ?

we import NumPy by a command "import numpy".

Numpy import in Jupyter Notebook



Here, "import numpy" command is used to import numpy.

we use "as" so that in functions we don't have to write numpy but instead of this we can only write "np".


Q. How to create an Array?

we can create an array by the command np.array().











Q. How to know the dimensions of array?

ndim is used to know the dimension of the array. It tells us that whether the array is in 1 dimension, 2 dimension or etc.,







Above array a is used in the above picture. a is in 2 dimension, so it gives 2 as a output.


Q. How to know the shape of an array ?

we can know the shape of an array by the help of the shape. It is performed below.








Q. How to make an array that contain zeros only?

we can make an array that contain zeros with the help of np.zeros( ). Let's perform this :-














Q. How to make an array that contain one only?

we can make an array that contain ones with the help of np.ones( )Let's perform this :-










Q.  How to make an array that contains the same value ?

We can create an array which contain only one value in the whole matrix.
Code is given below.













Q. How to make an identity Matrix with NumPy in Jupyter Notebook ?

We can create an Identity matrix in jupyter.

The code is given below.














Q. How to make an array from the random values ?

we can create an array of random values with the help of random.rand values.










Q. How to insert values in the existing array?

we can insert values in the existing arrays with the help of insert( ) function.









axis 0 means that add the value in the row and axis 1 for columns.
here, arr1 is the array.

2 is the index value.

8 is the value which we have to add.




Q. How to know the bytes in an array?

we can know the bytes of an array with the help of an nbytes.

Q. How to know the maximum value in array?










we can find maximum values index with the argmax( ). It returns the index of the value.


Q. How to know the minimum value in array?


we can find minimum values index with the argmin( ). It returns the index of the value.

Q. How to sort the array ?


argsort( ) sort the values and returns the index of the values.
Q. How to find non-zero values index of an array ?


nonzero( ) returns the index of the value which is not zero.

Q. How to add two array which contain strings ?


char.add( ) add the strings.


Q. How to use center function in array which has strings?


It center the strings and the char is filled both side according to number we pass, In this example we give 15.


Q. How to use capitalize function in array?



Q. How to use title function in array?

title function make the all words first letter in uppercase.

Q. How to use upper function in array?

upper function make all sentence in uppercase.


Q. How to use lower function in array?


lower function make all sentence in lowercase.

Q. How to use split function in array?


It split the words and gives a list in output.
Q. How to use splitlines function in array?


It split the sentence where "\n" is present.
Q. How to use strip function in array?



Q. How to use join function in array?


It is use to join the character.


Q. How to use replace function in array?


in replace function first argument is the string, second argument is character that we want to replace and third argument is the character by which we want to replace the second argument.



You can also download the Handwritten Notes. click here to download.

You can also download the Jupyter File. click here to download


Post a Comment

0 Comments