Skip to playerSkip to main content
Welcome back to our NumPy for Machine Learning series! Now that we understand array shapes, it's time to learn how to access and manipulate specific data points using Indexing and Slicing.
In this tutorial, we bridge the gap between core Python and NumPy, showing you the more efficient way to handle multi-dimensional data.

📌In this lesson, you will learn:
✅ 1D Array Indexing: Using both positive and negative indices.
✅ 2D Array Indexing: The "Row, Column" rule that makes NumPy so powerful.
✅ List vs. NumPy: Why array[i, j] is better than list[i][j].
✅ Advanced Tips: Mixing positive/negative indices and finding dimensions with len().

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 #Indexing #Slicing #DataScience #PythonTutorial #MachineLearning #Coding #بايثون #نومباي #الذكاء_الاصطناعي #شرح_نومباي

Category

📚
Learning
Transcript
00:14Welcome back, and peace be upon you. Now let's continue our conversation about sleep.
00:19Okay, let's see how we can do indexing. Of course, sleep is next.
00:25These rules are the same rules we learned in Python courses when
00:31We worked on indexing the strings, the lass, and the tabl. They are the same rules.
00:37Python followed indexing. Now, if you don't know what this rule is, uh...
00:44I forgot this link, I put the link to the video here first, the one that says
00:51About indexing. You can go to this link and watch the first video.
00:55About indexing rules. We'll continue in the remaining videos. Of course.
01:01This video is available in the Python Courses section of the channel.
01:05Follow us. It's included in Part One of Python Core. Now, I'm...
01:10Here's what I've put inside this notebook. You can open it if you want.
01:17This notebook. This notebook will be on [website/platform name].
01:21You can go to [website/platform name] and fork this notebook and [do something].
01:28On this link. I'll also put a little something for you.
01:33Put this link in the comments of this video. Okay, now this
01:39Badlas B, if you want, if you've forgotten the rules, the indexing print.
01:43First, we need to start; we need to start in order to create the indexing.
01:47For single-dimensional arrays, first we import the data. Then
01:52Here I've identified my index. Now, as you can see, it's there.
01:57Four items. I want to get the index zero and the index
02:01Three. Index zero will produce a dragon, and Index three will produce what? Four.
02:06Okay, I ran it. I got two and four. Same thing with indexing.
02:12The negative index, I want to get out, I am the one who is ...
02:17Minus one and the item that you curse Minus four. The artifact
02:21The minus one will be four and the two. I'm whipping, I want to get four.
02:27And the dragon. Minutes too, as you can see,
02:32The Single Dimension Array is a Straight Forward array.
02:35It means like you do
02:36Indexing for Tuple, List, or String
02:39It performs indexing
02:41For Single Dimension Array
02:42Here too
02:44As we said before
02:46It's something we can do
02:48What do we use the Lens Function with in an Array?
02:50Now, when I use the Lens Function
02:52With the array or
02:54What do I get for a Single Dimension Array?
02:56It shows me the number of items inside this array
02:58He gave me four because I
03:00I have four items here
03:02Okay, what about the Single Array?
03:04As we said, it's Straight Forward
03:06Okay, let's start now.
03:08Two Dimension Array
03:09Now the Two Dimension Array will be different because we will have
03:12Rose and Columbus
03:13That's why we need to put
03:15When we do indexing
03:17The Index is followed by the Row first.
03:19Then we set its index.
03:22Column
03:23Let me show you how
03:24Let's run this slug
03:26We'll look at the results and then explain that they
03:29One by one
03:29Now I want to leave
03:31In the First Row
03:33Of course, as we said first, we put the Index
03:36The Row followed him. Now this is it.
03:38The first row whose index
03:40Zero, just like I put it here
03:41Zero
03:42The First Element, which is seven
03:46Also the Index
03:47Zero followed, I put zero
03:50I put its index in the row, which is
03:51Zero and Index followed it
03:53The column is zero
03:55So that's how I got seven
03:57Now, as you can see
03:59It's in NumPy
04:02When we do indexing
04:03It's different when we do the indexing.
04:05For Nested List
04:08or Nested Tuple
04:09When we had a Nested List
04:11We used Hayk
04:13This is how we do indexing.
04:15For Nested List
04:17While in NumPy we just put a comma
04:20Between Indexing
04:21This is Indexing in NumPy
04:23Also, if we go out
04:25The second element in the first row
04:27What I want to reveal
04:29Second Element
04:30Which is 72
04:31In the First Row
04:33I want to put zero and what's one?
04:36Zero One
04:37The third element in the second row
04:39I want to get this out; I have the Second Row.
04:41Which is its Index, one
04:44The Third Element
04:45The Index was followed by a dragon
04:47And what else do I want to go out with?
04:49The Fourth
04:49The second element in the fourth row
04:52Which is the number 1 I have
04:54The index of the fourth row is three.
04:56The index following 1 is one.
04:59So I get one
05:01Of course, I can do what too.
05:03As much as I can work
05:03Negative Indexing
05:05Same thing
05:06Hello, here I have the same array.
05:09I want to go out
05:10First Element in First Row
05:12Hi, I have the First Row
05:15Which is its Index.
05:16Minus one
05:17The first element followed by the index
05:21Mins three
05:21So what do I get?
05:23seven
05:23Hey, we're running
05:24Hey, I got seven.
05:26Same thing
05:27Second Element in the First Row
05:28Which is 72
05:30The Index will be
05:32For Row
05:33Mins 4
05:33And for the Second Element
05:36Mins 2
05:37So I get 72
05:38Same thing
05:40Hello, what can I put?
05:41I don't put Negative
05:42Positive Indexing
05:44Just like I did here
05:45Set Positive Indexing for Row
05:48Which is what?
05:49Here I have
05:51Second Row
05:52Which is this
05:53What
05:55And put one mini
05:56Which is 6
05:57Item
05:59Index
05:59The 6 followed
06:00It came out to me
06:01What did I get? 6
06:02Same thing
06:03I can also
06:04Put the rows
06:05By
06:06Negative
06:07Negative
06:08Sorry
06:09And I put
06:10Column
06:11Positive
06:12I want to go out
06:13Second Element in the Fourth Row
06:15Which is 1
06:16Index
06:17Followed the Fourth Row
06:18Which is
06:18Minus one
06:19and the Index
06:20Followed the column
06:21Which is one
06:22I got one
06:23That's me
06:23By working
06:24Indexing
06:25in
06:252D Arrays
06:26Also now
06:28We know
06:28When we talked
06:29In the previous video
06:31When we want to use
06:32LEN function
06:33If we use it
06:35With the array
06:35It will show us the number of rows
06:37So if I want to do
06:39Check
06:40number
06:41Items
06:41The one in the column
06:42What should I do?
06:43Using Indexing
06:44Just like I did here
06:45phonograph
06:45LEN
06:46Array
06:49blow
06:493
06:50And I put a piece of my body
06:51He reviewed the number of items
06:53The one in the row
06:540
06:54I put the Index
06:56Zero Edition
06:56In this way
06:57Row Edition
06:59Just 0
06:59In this way
07:00And it shows me the Index
07:02what?
07:023
07:03If I had done it, I wouldn't have put the Index.
07:05It will show me the number of rows.
07:07In this array
07:08If you put the Index
07:09It gives me the number of columns.
07:11In this array
07:12So that's how I can use LEN
07:14Function
07:15And as much as I can work
07:16negative
07:17and positive
07:19indexing
07:20In 2D Array
07:21Now we'll stop here
07:23God willing
07:23In the next video
07:25We will continue
07:25And we talk about
07:273D Arrays
07:29See you in the next video!

Recommended