Hello Guys,
In this blog we will learn about the most important library of python which is NUMPY.
What is numpy?
Numpy is a python library that provides a multidimensional array object. It provide fast operations on array. With the help of this library we can do mathematical, logical and basic statistical operation on array.
To use numpy library we have to install it in our machine so that we can use this library. To install this library just insert the following command into your command prompt or terminal.
>>> pip install numpy
Now you can easily access the numpy library.
How to create 1D Array
In the above image, first we import the numpy library. Then with the help of array method we can create the numpy array.
On line no. 2 we create the one dimensional array. In this array you can store integers, float etc. In the array method we must have to pass list to create a array.
How to create 2D Array
In the above figure we create a 2D or 2 dimensional array. To create 2D array we have to pass one list in the array method and in that list we have to pass again two or more lists. So that we can create a 2D array.
So like this we can create n dimensional array in python with the help of Numpy library.
We will learn more about the numpy array like more methods of the numpy array in the next blog.
Please SUBSCRIBE to our YouTube channel.
Comments
Post a Comment