00:00Hello everyone.
00:02In this video, we will talk about matrix operations part 2.
00:07We will talk about filtering and fancy indexing concepts.
00:16First, we will talk about filtering.
00:18So, what do we do?
00:20If we generate the array,
00:22we will satisfy the elements
00:25and we will extract the filtering.
00:29First, we will create one dimensional array.
00:32Here, array less than 100.
00:37In this condition, we will satisfy the elements.
00:41First, 1.
00:421 less than 100 is true.
00:442 less than 100 is true.
00:46Then, 1,010 is not less than 100.
00:50So, false.
00:51So, when we check the array less than 100,
00:53we will return the boolean values.
00:56Results.
00:58Now, here,
01:00np.var
01:01Now, we have true values.
01:03That particular elements will be accessed.
01:05So, first,
01:07we have true values.
01:09That specific index is written.
01:11So,
01:13np.var
01:14So,
01:15np.var
01:16array less than 100
01:17array less than 100 are.
01:18So,
01:19array less than 100 are.
01:20So,
01:21array less than 100 are.
01:22array of.
01:23array of.
01:24array of.
01:25array of.
01:26array of.
01:27array of.
01:28array of.
01:29array of.
01:30array of.
01:31so,
01:32array of.
01:33array of.
01:34array of.
01:35we return the index.
01:38In this index, we return the elements.
01:41It says, array less than 100,
01:43which elements are array less than 100.
01:46So array of, array of,
01:49the condition, np.var, array less than 100.
01:52So, we return the specific elements.
01:54We extract the elements here.
01:57This is 0.
01:590th element 1, then 1st index element 2, then 3rd element 4, then 5th element 18, then 6th element 71.
02:16So, in this case, we will extract.
02:18If you understand customer, there is a direct method.
02:22So, array of less than 100, then we will add conditions to the direct element.
02:32Array less than 100, greater than 100, and array less than equal to 100.
02:42So, different logical operators.
02:44Let's check this.
02:46Even elements, we will extract.
02:48Array, modulo2, equal to equal to 0, then we will extract even elements.
02:55If not equal to 0, then we will extract.
03:00This is a particular filtering concept.
03:04Next, what do we do?
03:09Fancy indexing.
03:10So, fans indexing.
03:12We will select the entire row and entire column.
03:14There is no order.
03:16There is no step size.
03:18We will access the rows and columns.
03:22Both rows and columns.
03:24Now, first I will set,
03:36So, all elements were 0 in the integer data type.
03:38So, I will select array and array so,
03:40So, I will select,
03:42So, for use values, we will assign values to the values.
03:47So, for I in range of, number of rows, what is the number of rows?
03:52We will extract the rows.
03:54Array2.shape.
03:55Array2.shape, we will return rows and columns.
03:59We will extract the rows and columns.
04:01We will return the rows and columns.
04:03We will return the array2.shape.
04:07So, first, I will run.
04:16Array2.shape.
04:18We will return the elements in the tuple format.
04:22So, in the tuple format, we will support the indexing.
04:26So, 0 and we will extract the row value.
04:30So, we will do this.
04:32We will access the row value.
04:35So, for I in range of, 10.
04:39If we say, array2 of 0.
04:43I will first value 0.
04:45Because I have number of rows is 10.
04:47I will value 0.
04:49So, array2 of 0 elements, 1.
04:54So, array2 of 0.
04:57So, in this specific row,
04:58we have 0.shape, we have 0.shape, we will generate 1.shape, we will generate 1.shape.
05:06Next.
05:07Next time, we will run.
05:08Array2 of 1.
05:09Normally, array2.shape, what is that?
05:11We have 10x10 values.
05:13Now, we change the values.
05:14So, array2 of 1.shape, we can index to 1.shape, this particular row.shape.s.
05:17of one are in the particular index
05:19so in the row full access
05:21that value
05:23we will set
05:25i plus one
05:27so two are set
05:29so this is
05:3110 cross 10 matrix
05:33we will assign value
05:35we will apply
05:3710 cross 10
05:39value matrix
05:41then the matrix
05:43values assign
05:45next we will find the fans
05:47indexing
05:49how to do it
05:51now
05:53this is RA2
05:55RA2 of
05:576,3,8
05:59row
06:010,1,2,3
06:034,5,6,7,8,9
06:05now
06:076,3,8
06:096th index
06:11row
06:132nd row index value
06:153
06:17so 3rd index
06:19entire row
06:21that is 4
06:23then 8
06:25we will get the extract
06:27entire row
06:29without any specific order
06:317,8
06:33and then
06:349
06:35in the values
06:37we will access the
06:39fancy indexing
06:41next columns
06:43we will access the entire column
06:45we will access the entire column
06:47the same values
06:49we will generate
06:51let's say
06:53column index
06:550,1,2,3
06:574,5,6,7,8,9
06:59now
07:01in the specific column
07:03just say
07:05we will access the same
07:06here
07:07we will have the same elements
07:08we will have the same elements
07:09we will have the same elements
07:11like different linespaces
07:12we will create
07:1310 cross 10 matrix
07:14we will extract
07:16now we will have the third
07:17seventh
07:18and ninth index
07:19column
07:20extract
07:21now
07:22in the third
07:23seventh
07:24and ninth index
07:25column
07:260,3,7,9
07:29in the column index
07:30value
07:31we will provide
07:32so
07:33we will access these
07:34three specific columns
07:35without any order
07:36step size
07:37equal
07:38we will access any order
07:40this is the
07:41fancy indexing
07:42for columns
07:43row
07:44direct row
07:45index
07:46pass
07:47and
07:48column
07:49entire row
07:50column
07:51index
07:52provide
07:53next
07:54next
07:55now
07:56one
07:57range
07:58use
07:5916
08:00elements
08:01create
08:021
08:0316
08:04next
08:05now
08:06reshape
08:074 cross
08:084 matrix
08:09now
08:10array
08:11of
08:120,123
08:130,123
08:14pass
08:15then
08:16row
08:18row
08:19columns
08:20so
08:21entire row
08:22entire column
08:23is
08:251
08:26and
08:27row
08:28column
08:29so
08:301
08:31by 1
08:32value
08:33this is
08:340,123
08:35this is
08:360,123
08:37this is
08:380,0,0
08:39this is
08:400th row
08:410th column
08:42value
08:43next
08:441
08:451
08:46so
08:47first row
08:48first value
08:496
08:502
08:51and
08:522
08:53second row
08:54second column
08:55value
08:5611
08:57then
08:58third row
08:59third column
09:00value
09:0116
09:02so
09:031
09:046
09:0511
09:0616
09:071
09:081
09:091
09:101
09:111
09:121
09:132
09:141
09:152
09:161
09:172
09:181
09:192
09:201
09:212
09:221
09:231
09:241
09:251
09:262
09:271
09:282
09:291
09:302
09:311
09:322
09:332
09:352
09:362
09:372
09:383
09:393
09:401
09:412
09:422
09:433
09:442
09:451
09:462
09:473
09:481
09:491