Skip to main content

Numpy Library


 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

Contact Form

Name

Email *

Message *

Popular posts from this blog

Countdown Timer Using Tkinter

Countdown Timer Using Tkinter With the help of tkinter we create a countdown timer project for beginners. Tkinter is the built in python package. Tkinter provides GUI (Graphical User Interface)toolkit. With the help of this developer can create any GUI projects.  Steps of the Project: 1. import tkinter package 2. create a basic gui  3. add entry for Hrs, Mins, & Secs. and start button 4.  Create a function containing logic of timer   Step 1: Importing required packages   Step 2: Create Basic GUI  Step 3: Adding entry for Hrs. Mins. & Secs. and declare variable to store this values. Step 4: Create a function to perform timer. This is how we create countdown timer using python tkinter.  In this project we use divmod() function. This function helps to calculate quotient and remainder both. for example:- 1.print(divmod(25,5)) => (5,0) 2.print(divmod(5,2)) => (2,1) In the first example 25 is divided by 5 so quotient is 5 & remainder i...