Advanced Python Library - Numpy Array for Beginners | EasyLearn Spot | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Advanced Python Library - Numpy Array for Beginners

teacher avatar EasyLearn Spot, Passion for teaching

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

12 Lessons (55m)
    • 1. Course Introduction

    • 2. Introduction to Numpy arrays

    • 3. Numpy installation

    • 4. How to Create Numpy Array

    • 5. Datatypes in numpy array

    • 6. Indexing in numpy array

    • 7. Slicing in numpy array

    • 8. Functions in numpy array

    • 9. Broadcasting in numpy array

    • 10. Numpy Array Manipulation

    • 11. Iterating Numpy arrays

    • 12. Numpy Course Summary

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

This course is designed for python developers who want to enhance their career in Machine Learning, Data Science, Artificial Intelligence. 

Numpy Array for Beginners covers:

Introduction to Numpy Array

Download and Install Numpy Array

Creation of Numpy Array

Datatypes in Numpy Array

Numpy Array Indexing

Numpy Array Slicing

Numpy Array Functions

Numpy Array Manipulation

Iterating Numpy Array

Course Summary

Meet Your Teacher

Teacher Profile Image

EasyLearn Spot

Passion for teaching


Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Course Introduction : Welcome to the course on Python NumPy array. I'm sometime like me, I'm a freelance software Trina. I wouldn't be the instructor for this course before it be warned to the course, let me tell you the basic concepts you'll need to know before starting this course. You should have prior knowledge about Python programming. As numpy isn't advanced by Don leg review the concepts used in his goals are mostly be stored Python concepts. You feel at a by Don definite bla, I'm, you want to enhance your knowledge towards machine learning or data science. This is the best course for you to learn. In this course, we will learn a moat by adding its functions, indexing, slicing, and more advanced NumPy concepts, Autauga included dinosaurs, practical exercises at all. It's the added after each doping. After learning the concept in each video, you'll get back to the exercises which are included in this course. By the end of this course, you'll be able to perform data operations on any n-dimensional. Adams. Once I gave, I become u onto this goes Happy learning. 2. Introduction to Numpy arrays: Welcome back. Now let's see what this NumPy array and it's speeches in D-Day. Numpy is one of the most popular machine learning library in Python. Numpy stands for numerical Python. It is very interactive and easy to use. Numpy has a huge collection of advanced mathematical and scientific computing packages. We can make a complex mathematical implementations very easy. It lets you to create multi-dimensional arrays and matrices. Nobody is an alternative to MATLAB. You just have cross-platform, which we also use it with packages like Matt. Thanks guys, Bye. Now let's see what is mean by NumPy array. Numpy is initialized in the form of arrays. We all know that we don't use arrays in Python. Instead we use list in Python. However, NumPy arrays are fostered that Python list, Let's see how it differs from Python list. Numpy uses much less memory to store data, then Python list. And these datas are stored at one place in the memory. Python list contains single odd different data types within a single list. However, not buy at a low one single datatype. The mathematical operations can be performed on arrays, one only if the RAs are homogeneous. This is all about NumPy arrays. In the flooded videos, let's see how to install NumPy array and how to perform the operations using NumPy arrays. 3. Numpy installation: Then come back. Let's create our first program, enough light. To do that. We need to install numpy. Do we install NumPy? You need to have Python 3 and pip installed in your system. To check if Python 3 installed in your system. Go to command, prompt and type Python. This displaced the motion of the Python installed in your system. Note the philosophic madmen decided to spike. We have Python installed. The second and the most important. If beep, beep this the package install left slot by Don, we need to have to install Python leg release. Note next, check whether this installed. Once I hit Open Command Prompt, hi. This list out all the comments as Fitbits or inbuilt Python package. It will be available along with Python. So that is no need to install a separate API. I second requirement is also satisfied. No legs installed, not by Open Command Prompt. Installed NumPy, right? That's it. Num by gut, installed successfully via ready to write our program me know, Bye. Open Python, IDE and type import numpy. If no edit box, baby can consult that NumPy is installed properly. We can write Python programs in Python, ideally, we can use our wall, I'd like by chomp on a goddess by the exit. I'm going to use PyCharm as my ID to execute NumPy code. Let's see how big the audit PyCharm IDE. Pycharm IDE, and create a project. We need to install NumPy package in PyCharm IDE. For that, we need to click on Site Settings, select project, and select Project Interpreter. In the project, interpret that window. Click the plus symbol, doing started that back each byte in the search and click Install button below. Know NumPy got installed successfully. Let's go back to the bike shop. Mean we know, right-click on the project and select New Python file. Type the file name, and press into your Python program is created. Let's start creating the board to check NUM byte version. Then you write the NumPy through. Your flux line should all be stuck with import NumPy. Numpy bullshit. Next type, break. Open bracket. Numpy dot. I'm just quote underscore bullshit. I'm Misko does close bracket. To execute the board. Right-click on the screen and click the button. You can see the output in the console window. Numpy motion block displayed in the window. No, let's get the num pi beta quantity Grecian. Break open bracket, num dot show undisclosed con fy Gough, close bracket. Before executing this good Next comment, the previous step. Now, click run and execute the world v-hat edit function available to get the information about NumPy by methods. To get the head. Let's type rentals. Numpy dot info off by dark sheep. All the information about the shape function, like how to write the shape function. What does that to view itself ship everything will be displayed in the output. That's a VM. Then with the installation and execution not Fellows Program. Bye. See you in the next video. 4. How to Create Numpy Array: Welcome back. Now let's look how to create a NumPy array. Numpy array objects are in the array. We can create ND array object by using the audio function. Now let's see how to create. Our first step will be usually as import NumPy as np. So edit P is the allies which we are going to use Insider program. So instead of using NumPy, we are going to US GNP allies mean. So to create a NumPy array, Let's type np dot avails. Inside that, you can list all the elements. So this array to be stored in a variable called a. And let's bring the adult to view the output. Just click. So you are able to be displayed in the console window. I can pass a list as your array. You can pass tuple also as an array. So AW can use in this format. So np dot i. Then you can pass to us you array elements. So you can click on Run to view the output. So now you can see both displays the result in the format of arrays. But in the first study, we pass input as a list. And in the second format, we pass the elements in the form of a tuple. So this is the baby create a basic array, NumPy. Now let's learn that different dimensions in NumPy arrays. So usually the diamond starts from 1D array, which is also known as unidimensional array. This array has zero-dimensional arrays as its elements, and this is not the most common and basic array. So let's create them 1D array. We just saved what we have created before. So we just nothing but np dot array of the values can be stored inside that. This is the output of the one-dimensional array. So it displaced output asset is no, Let's see what this two-dimensional array, an array that has 1D array as its elements is called a two-dimensional array. So now let's create a two-dimensional array. It just np dot. Hi rails. Inside this via going to create two list. And we're going to print the output. So this is severely create the two-dimensional. So now let's see what does three-dimensional arrays. And added that has 2D arrays as its elements. 2d arrays or nothing but mattresses, we just call it 3D array. Now let's create a 3D array and we have created a three-dimensional. So here you can see that it is created in the form of matrices. This is the baby create an array now. And these three-dimensions, now, we do have a seat or deiodinase 0, which is not being but all the scalar, scalar r is nothing but the elements in an array. Each value in an array is called a scalar. So we can create a scalar array. Creation of scalar array is very simple. So just we are going to say num by a dot, adding some value. And we are going to drink. Your output will be printed as it is. So this is called an escape. It will print out the a Mac. This, whichever is given in the array. 5. Datatypes in numpy array: Welcome back. Now let's learn about the data types in NumPy. And these are the data types in NumPy. The already know how to import. Now, we have created an array, np.array of 12, which is a scalar. Now, if we want to follow the data type of this particular array, we are just going to print it out as a one dot dtype. So it will display the output integer 32. So this is the data type of this particular AMI. So now let's create an array. This is the one-dimensional array. Here we are using the same dtype to found out the datatype. And this also retained set in digital to-do us and let me know, let's see how it loves water. String typos content. So I have stored the string it as a limit. Now let's find out the data type of this type of ion. So this is the VAB such that data type of that particular array. Let's see how to change the data type of integer element array to a string datatype. So we have created a one-dimensional array. Now let's change the data type from integer to a string. And now let's print the array. So now this changed from integer to string datatype. Now let's print the data type of this particular, I mean. So you can see that you chose as a string data type. So this is the baby change the particular data type to a string, audibly can change it to float. If you give the datatype as float, the value will be obviously changed to a float value and your datatype is also changed to float that they do. And you can either change it, do Boolean data type Watson. So it will display use as a Boolean data type. Now let's see how to change the data type a, the sum integer to a float or integer to Boolean, odd flow to integer. We can change the array elements, two different data text. Let's see how to do that. So to do that, we are going to use the method astype, say the bracket. You can decide to what you want to change that particular array elements to know I want to change the integer array elements too. Data. But I'm just using astype boss. Yes. So it will change the integer values and it will display the output in float format. So the values are changed from integer to float value. The same way we can change that to Boolean. And it will display it in the Boolean format. So this method will change that particular array element values from one data type. Do we get no change? The array from float datatype? And I want to change it to integer. So now I want to change the particular float type of elements to integer data type, and it automatically converts the float values to integer values. So this baby can convert any type of other elements two and another data type a, then we can do yes, which will convert the full float values to a string data type. So we have learned about the data types in NumPy array and how to create an array data type included. And we can change the data type of that particular elements. 6. Indexing in numpy array: Welcome back. Now let's see how to access an element in a NumPy array. We can access an element inside an AMI. You will say it's index position. They index position of an array always starts from 0 and it continues bit one to it, and it goes on. In this example, you can see that the particular array index starts from 0. And the other values 1-bit, one to four day it moves on Beta values. And you can also access. You've seen negative indexing, which is nothing but if the value stocks in the reverse for me, it always starts from minus one. So minus one represents the last element in the array. And minus2, baby, the element before the last day limit. So you can either access the array, you'll see the index position with the positive values as the less the index position be that they get u values. Let's see the indexing with that example. So we have created a non-metal NumPy array. We feed want to access a particular element from that array. If I mentioned the index position of 0, your first value that this Nevin will be displayed in the output. So they index position starts from 0, so your first value will be Nevin. And if I give the index position has to, obviously, it will be 0 in the 0 position, 11 is dead, and the first position to L, and in the second position, third being should be your output. So 13 will be displayed in the output. So this is the baby access, the element in that NumPy. And also you can use any operate else. You can use an addition operator to add two elements. Daddy. So I can do in this format on Zoom. So my IRA one knows to index portion will be 30 and that's in the 0 position. The value of 11 is dead, so blood gets added and they'll put those two in default will be displayed in now. So you can see the output like that. A one-off do position is D. And a one not 0 position stands for 11, and the output will be between people. So this is a baby. We can do that basic operations using the fight at a eliminates. This is single-dimensional array. So if I want to access the elements from the 2D array. So now I have created a 2D array. Now I want to access, though, particularly met from this 2D array. So I'm going to use the same format. And then just giving the value S one comma two. So what will be the output of this particular indexing? So your output, this AD, so how it got this plague is the first value represents that diamond shape, which is nothing but the 0 dimension. And this is the one study. I mean, the first study. You want to access the second element that this second index position of index position two. So this is 0 and the index portion of this one is one. And the index position of AD, obviously the value 18 block displayed in the output. So this is the way we access the elements from the Doobie. I have created a 3D array. So now let's see how to access the limit from this 3D. So the same format we are going to use, print dose if ARR three. And inside this bracket we are going to mentioned the positioning. But I have just given a desk one comma, one, comma one. So let's see what will be the output. So 21, God displayed as the output. So let me explain how we displaced the output. So the first represents the diamond shape. So what does the dimension? This is the Z dimension and this dimension. In the first one. Again, we are going to go for the index portion. This is 0, this is one. And that particular array, the outgoing to access the index position of one. So this one is 021. Value gets displayed in the output. So this is a baby axis. They elements from the three-dimensional army. You get to use the same format if you want to access the particular element using negative indexing also, you get for loop. So if you want to follow the same, you can use it in this format like minus1. And let me execute this. And knowing this place 22, why? Because minus1 starts from the last value in the AMI. So minus1 represent this value and plus one represents two main D1. So if I say minus1, obviously 22 will be displayed in the output. So this is called the negative indexing volts. So indexing, It's the way of accessing the array elements with positive values and negative indexing means accessing the array using negative values. And the index position always starts from 0 and the negative indexing starts from minus one. 7. Slicing in numpy array: Welcome back. Now let's learn about slicing. Slicing is nothing but extracting the particular set, those values from the alley. For slicing the elements from the array, we need to give this talk value as well as that end value. No, I haven't created a basic array. And I have displayed the output of that particular Red Army. To perform the slicing, I'm going to give the tag value as well as the end value. So I'm just giving one is to seven. So the output will be the index position of one stocks from 12. And the seventh position in AD by actually in slicing pons, the value, the value before, one value before that ending value. So if the index portion is seven means obviously the index portion will end in the sixth position. So it will start from the Philistine exploitation and the sixth index position. So it starts from 0 to L and it displays to 17. So this is the baby slice, the array. And we can also slice in the format of cooling seven. It will also look like the same of what the only exception is. Yeah, I haven't mentioned those tapping value. So by default it takes the stock value as 0 index position. So the value stocks from 0 index position and it in 16 index position. So obviously it will be split from 11 to 17. Oh, and you can also mention in this format. Here, it means that it's stacking values given by the ending value is not defined. So the stopping position is three, which is 14 is the third position, index position value. So it starts from 14. It will display all the values till the end. As I haven't mentioned in value, the value will be till the end of that. So it displaced from 14 to 20 as our output. And you can also mention with the double colon splitting displayed the alternate values in your output starts from the index position 0. It will skip the next value, and it will display the next value and it will speak skip the next. So alginate values will be displayed in them. I'll put them down in a flaw might be finding the slicing syntax can give you a starting value. And you can define your ending value. Asks the list, you can give this tip. But what it does this, it starts from the index portion one, we just dwell and a dense with the index position 7, which is AD. And after that, it eat as a step value of. Step value mentions how many values it should skip. It keeps up by piglet alginate elements that starts from the next question, 1, which is 12, and it keeps 30, and it displays 14, it gives 15, it displace steep and get skipped 79, displeased AD. So step value more or less, it looks like the before step, which is double colon to back. Hear me, I'm mentioning this tacking value and being value as well as the state value. So you can also use that negative indexing here, which is I have given the stacking value as one and the ending value S minus two. Some of the previous topic, the adenine know that getting mixing starts from the end of the array. Minus 2 represents the element we just, it starts from minus one, and here it represents 90. Vital obviously add in the index portion will be minus three, so it stops the w of ED. So this is debit negative indexing books. This is how we slice the elements. Indeed one-dimensional array. We can do this in the two-dimensional array on so now I have created a two-dimensional array. Now let's list the values in that two-dimensional array. Now I have mentioned that the two values, first values represents the dimension. Here, it represents the next. And this is the first index. So it takes the value from this particular array. And in this array I want to finish the values from one GIF file. So it starts from 70 and it ends with the train Dee. So as data one for index positions available, but still I have mentioned the test file like now. It's not an issue because for index portion is already available. I should not mention six as my index position here because they element is not available. This is the baby slice, the elements in that two-dimensional army. Also I can do it in this format. So here I'm going to NDB, the in-between indexes 01 lead because the more considered the last value. So obviously we can take the values one, we slice the values one leaf from the first explosion 0. And intact I want to fetch the value of two, so 012, so 13 will be displayed in the output. So in this format, what I have doneness, I want to access the slice, the element from both the admin. So I want to eight the element of three from this side as well as probably studied. So I have mentioned it does 0 or Purdue. I want to access the study also to deciding also from this study. And I want to access values from the third index position. So from this study, that third index position 0, 1, 2, 3, that is 14. And from this study, they index position of 3 is 0, 1, 2, 3, which is 19. So it takes the value from both daddies and displacing the output. So this is also a format to slice the elements from the two-dimensional array. This is how we slice the elements from the NumPy array. 10. Numpy Array Manipulation: Welcome back. No, Let's see above D, IRA man depletion concept in NumPy arrays are a manipulation is nothing but reshaping the iron's. Reshaping means changing the shape of an arrow. The Kanye that change the number of elements in each dimension Ought we can add or remove dimensions. Know, let's see how to convert one-dimensional array into a two-dimensional array. Here, I have created a one-dimensional array, and I have printed it out. They'll put displace the one-dimensional army. No, let us see how to reshape this army. To reshift the RAB have used a method called Vichy. Here I have dot dot reshape of two comma bed. The two represents the outer diamond shape and the fight a presence then number of elements in each array. And we can also give it this fight come up to fight a presence touted dementia that Fiat It has been created and the tool that presents that elements and initially tried to fight come out. It will display data because we can't ship this. I asked this at a time to stop one week data elements. So if the element of the array matches the d values which will be given in the V-shaped met the V1 lead book. Otherwise it will display. Let's see how it will convert that might be dimensional array into a single-dimensional array using the seed reshape Balsamiq third, instead of positive values, if I mentioned reshape of minus one, it might be dimensional array into a senior dimensional army. Here I have created a two-dimensional array. And I have used the method V-shape both minus1. And once I execute this output, flat ends my IV. So it converts the two-dimensional added 11 using the seed bee shipment or that is also a default method for flattening the addie, which is called a flat and also emit the flat announcement. Third, build returns that copy of an array, which also converts that might be damaged in arrays into a single dimension. So instead of reshaped minus 1, we can use the method called Slack and it will also display the same or what. It will convert that two-dimensional array one dimension. And also you can mention the ADA pada, meet it as yes. It is drawn style. But that is another one function called ravel function, which also returns a flattened one-dimensional array. Jia one lead that copy is, once again, I'm using the scene two-dimensional array and then changing the method to Ravel off method. And the output will be C, D. And also you can use the ADA. You can give the CEO style. And it really displayed. I'll put in there for myself, for Bronstein. Then what does the difference between this flattening method and Ravel? Flattened better returns? Flat, one-dimensional array. That Evan method also they can suck Flat. And one day I mentioned that the only difference between these two methods, this flat handwritten stuff copy of the original entity by travel method returns a view of what digital ID. No, Let's see some example. Here. I have created a two-dimensional array. So I'm using the method flat panels and I'm mentioning the index position 0, and I'm assigning the value as nine, thought that the index position. Still, if I tried to print out that array, displaced the same original array, nothing got changed using Slack and method by piece, I use valid method instead of flattened method in the output, you can see that the value in the index position of 0, but from 11 to nine. So this is the difference between the flatten middle and I hope you understood the byte array manipulation fonts. Let's meet in the next video. 11. Iterating Numpy arrays: Welcome back. Now let's learn about I treating done num by adding I taking means going through the elements one by one. We can say that I take the 1D array elements. 2d array elements are 3D array elements. No. Next, see how blight trade the 1D array elements. Here I have created a one-dimensional Ani. No. Next, see how I treat this via using the for loop concept. So far are a one. And we're going to print out the value of I. So here, each and every value from the one-dimensional array will get stored in the eye and it will be displayed in the output. So this is the way I train folks on one-dimensional army. If I want to isolate the elements in a two-dimensional array, we have created a two-dimensional array. We are going to use my deeply for loops. Do I treat the elements inside that? Toby? I have given two for loops, kill, fought, and fought. Ye. Yes. So first, we'll display the output as list and a secondary splits the value from that first lifts and displays the output in the form a DOS indigent elements. This is the baby. I take that two-dimensional know what MIT to see how I treat three-dimensional array. Here we have created at three-dimensional array. And we are going to use three for loops for the x sin x. Is it in white? And we are going to print the value of, Isn't it? So it is also going to display all the values in the output, but via dot is 1 by 1. V also have a default method called eNB method, which will also do the ideation as easily. If I want to, I treat a one-dimensional array using the AND item method, we are going to specify as far as np dot NBI debt off, we are going to specify that Amy and in the square brackets via going to mention stock and the end index position. So here I have given the desk pool and fight. So it starts from the 0 index bullshit, and it will display the values for the index position 0. This is how it looks. See one-dimensional array. Now let's see how do you scan the item method in a two-dimensional. Are we good? I have created a two-dimensional array. And in order to IT, the values we are going to give it as np dot in the i turtles are a one, which is a neat. And inside that I have given the colon n, which will display all the values. So if I want to display all the values, but one Nita I to need values should be skipped a beat, I need to do double colon, which we'll skip the ad to need values. So here he is placed the value 11, 13, 14, and 16. So 12 and 16, God's deep. And you want to use the CME AND item method inside the 3D array means we need to use which will display all the values. Odd. You can mention the stock and in position. And you can also mentioned this tip value that you can mention it as colon colon two, which will skip the ultimate values. If we mentioned it does. It will display all the values. I have given a desk colon, colon to. What good does this colon, colon to skip the second daddy completely. Because in the index position one will be completely. So you can see that the output one leaf displays 11, 12, 13 as the less, 17, 18, 19. God displayed 14, 15, and 16. Going deeper. It is because as this is a three-dimensional array, it gives that it, which is in the index position one. So if you wanted to display the whole array, just mentioned one liter, which will display all the values. And if you want to keep some arrays, you can mention the step value. So this is how I draping the non-finite added votes became A1 US have a deep flood for loop concept. Audio can use the NB item method. Do I trade the White Army? 12. Numpy Course Summary: With this, we have come to the end of the course. In this course we have covered the basic concepts we need to know about denim by adding. We learned about the basics of NumPy arrays. How to download and install NumPy arrays. Creating NumPy array, how to access an array using indexing and slicing. Ve learned about the NumPy array functions and broadcasting concepts. I didn't man population is also covered. We also learned two, I trade that number by adding hope you enjoyed this course. Next, meet again in a new goose. Thank you.