Skip to playerSkip to main content
Welcome back to our NumPy series! In this video, we master 3D Array Indexing and explore how to use Negative Indices to access data from the end of an array. We also compare using len() versus the .shape attribute to understand your data's structure.
🚀 Next Step: In the next video, we will start our deep dive into Slicing! Don't forget to subscribe to Intuidemy to keep up with the series.

📌In this lesson, you will learn:
✅ The 3D Indexing Rule: Navigating through Depth, Rows, and Columns.
✅ Using Negative Indexing: The efficient way to grab elements from the back.
✅ Hybrid Indexing: How to mix positive and negative indices in one command.
✅ len() vs .shape: Which one should you use for multi-dimensional arrays?

Liked the video? Don't forget to 👍Like, ↩️Share, and 🔔Subscribe!
!هل أعجبك الفيديو؟ لا تنسى الإعجاب، المشاركة، والاشتراك في القناة
@Intuidemy

🔗 Links & Resources:
GitHub (Source Code): https://github.com/rubada/Machine-Learning-with-Ruba-Dabbas
📺 Full Pandas Playlist: https://dailymotion.com/playlist/xdkjni

#NumPy #3DArrays #Indexing #MachineLearning #NegativeIndexing #DataScience #بايثون #نومباي #الذكاء_الاصطناعي #تعلم_البرمجة #شرح_نومباي

Category

📚
Learning
Transcript
00:14Welcome back, and peace be upon you. Now we'll continue our conversation.
00:19Indexing in Namefile. We want to see how we can implement indexing.
00:22For 3D Ariz. Now in 3D Ariz, as we know, we have
00:26The first one is the first dimension, which is the number of arse segments. Yes, the number of arse segments in
00:34This is the dimension. The second dimension is the number of roses in each of these areas.
00:40The arithm. And the third dimension is a number in these arithms. Okay, let's see.
00:48So how can we do the indexing now? Now I understand what this is.
00:543D ARI consists of two ARIs. Each ARI contains two roses and three columns.
01:00Okay, let's see how we can do it. Let's do indexing. First...
01:04What do I want to get? I want to get the first one, the one in the first one.
01:09Ro from the first area. The first thing I need to do when I want to index is put
01:13The index is followed by the first row. The one I have here has a zero index, just like...
01:17I've put it here. Then I'll put its index, the first row, which is this one.
01:24What? Its index is also zero. And then I put its index as a column.
01:29Which is the one with the three, which is also zero. So that's how I get the index.
01:34Zero zero zero. As Aji, you're doing a tran. Ahi, you see? The first item that came up for me
01:39Three. Okay, let's move on to the second item we want to get. And we want to get
01:44The thread is in the first row. Is it in my first row?
01:50The index is zero, just like I put it here, zero. Then I want to go out.
01:56Which is this. Yes, this is it, and its index is one, as I have put it here.
02:02And then what? I want to find out that Eli is thirty-one. And that will be
02:07The index followed it with 2
02:08Just like I did here, 012
02:10And I got 31
02:12I want to go out now
02:14second element in
02:15first row of
02:17I have a second array.
02:18The index of the second array will be
02:20What will be 1 and what do I have?
02:23The first row will be the index.
02:24I followed him, and I was in his hands.
02:26The second element, which is nine, will be
02:28The index followed it, 1, V
02:301 0 1 then
02:32I want the first element in
02:34second row in second array
02:35The second array will have one index.
02:39And then the second row will also have one index.
02:42The first element will have an index of zero.
02:46Hey, one one zero came up for me, what's up?
02:49good
02:50Now we can also do negative indexing
02:53Hey, I have the same thing.
02:563D dimension array
02:58Now I want to find the first element in the first row from the first array
03:01Let's do the first thing: run
03:03Okay, first of all, what will the index of the first array be?
03:07I have two arrays here, so their index will be minus 2.
03:12And the first row too, because I have two rows.
03:15The index will be
03:16The first row is also minus 2
03:18Hey, here I put minus 2 for the index
03:21minus 2 for what?
03:23For the roo
03:24And then, because I have three columns here
03:26I'm happy to have
03:28Item number 3
03:30What will he have?
03:32The index was minus 3
03:34So that's why I get minus 2
03:35minus 2
03:36minus 3
03:37The item I got is 3
03:40The thread element in the second row of the first array is called "Khalib Hala Al-Thard".
03:44Hello, the first array, as we said, its dimension
03:48It means it will be -2 if we want to be negative, or what? Zero
03:52I'm here now, set to zero, to show you that we can use it.
03:56negative with positive indexing
03:59So here I put the index of the first array
04:18The second element in the first row of the second array
04:21Hello, the second array has an index of one, and I've set it to positive here.
04:24The first row's index has minus 2; I put minus 2 there.
04:30And in my hand is the second element, which is nine, the index of which is seven minus 2
04:35Here I got nine, and the last thing I have is the first element in the second row.
04:40In the second array, the index of the second array is minus 1.
04:44The second row, I set its index to positive here.
04:491 and the first element in the second row, which is 1, I put it as minus 3
04:55I prefer the 1. Okay, now we've used it too.
05:00What is the len function with 2D and 3D arrays to find the len, for example?
05:09A 2D array gives us the len; a 3D array gives us the number of rows.
05:15How many arrays are there if we use it alone?
05:21We can use it with indexing, as I've done here.
05:25I wanted to find the number of rows, so I used `len`, typed `array`, entered my array, and set the index to 0.
05:34What do I get? Let me show you. I got a dragon. What is the number of rows in each?
05:40The array, of course, here too I can put one, meaning I can choose either index zero or index
05:47One of these arrays is the same for columns; I'm talking len array.
05:54First, I put, for example, here I put my index in the second array, which is this one, and then I put the index
06:00I followed the row, which is zero. Of course, I didn't put zero or one, and it will give me the same result.
06:06What I got was the number of items in this row, which are the columns, and I followed it.
06:11But we don't use that kind of talk. What do we use? We use the shape object. As you know, what is a shape?
06:19He gives us
06:19The shape gives us a height, and when we print it, it gives us a tuple. So we can, for example, find the number of arrays in this one.
06:283D array
06:30I took my 3D array, set the shape, and set the index to one, so it gave me the number of arrays (two) and the number of rows (two).
06:37I put a shape index
06:47He gave me three, so I can find out the number of arrays, the number of rows, and the number of columns in the 3D arrays, and the same
06:55I can use 2D arrays
06:58I used the shape to find the number of rows and the number of columns. Okay, we'll stop here now, and hopefully, there will be more.
07:05In the next video, we will continue
07:07Thank you, and I'll see you in the next video.

Recommended