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 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
Two - Dimensional Array example is given below.
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 :-
- Fast
- Convenient
- Less Memory
Q. How to Import NumPy ?
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?
Q. How to know the dimensions of array?
Q. How to know the shape of an array ?
Q. How to make an array that contain zeros only?
Q. How to make an array that contain one only?
Q. How to make an array that contains the same value ?
Code is given below.
The syntax is : np.full([row,column], value)
Q. How to make an identity Matrix with NumPy in Jupyter Notebook ?
The code is given below.
Q. How to make an array from the random values ?
Q. How to insert values in the existing array?
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?
0 Comments
If you have doubt, let us know...