1 00:00:01,440 --> 00:00:06,380 So in this lecture will cover important libraries of Python. 2 00:00:06,390 --> 00:00:16,920 It is named by pandas and Seabourn so we will open our two parter on screen one new Python 3 non book 3 00:00:22,240 --> 00:00:29,490 first will cover the name by number is the code numerical computing package in Python and that school 4 00:00:29,520 --> 00:00:37,350 type is and B re also known as Num by array. 5 00:00:37,700 --> 00:00:39,650 You can change the title of notable 6 00:00:48,140 --> 00:00:50,610 end to this. 7 00:00:50,770 --> 00:00:56,800 There is also an auto save feature in Dubai notebook so you don't have to worry about saving it. 8 00:00:58,500 --> 00:01:05,950 Number of packages almost using in all numerical computation using Python and it provides high performance 9 00:01:05,950 --> 00:01:10,670 vector metrics and higher dimensional root stock tips for by them. 10 00:01:10,970 --> 00:01:20,270 It is implemented in C and Fortran and that's why it is much faster than Python and functions to use 11 00:01:20,270 --> 00:01:20,780 numbers. 12 00:01:20,900 --> 00:01:30,290 We need to import the module to import the module will write import number as and b 13 00:01:33,150 --> 00:01:35,140 since we are using Anaconda. 14 00:01:35,200 --> 00:01:42,120 There is no need to install this libraries all the important libraries are already installed using the 15 00:01:42,180 --> 00:01:43,180 anaconda. 16 00:01:43,530 --> 00:01:49,740 And if you are using Python you have to use weapons code in the command from the install this library 17 00:01:53,010 --> 00:01:56,390 there are various ways to initialize the name by. 18 00:01:57,910 --> 00:02:05,170 We can either convert existing Python this sortable or we can generate an umpire array using functions 19 00:02:05,170 --> 00:02:08,170 like aiding and line space. 20 00:02:08,170 --> 00:02:17,950 So let's start with numbering will create a variable and be one if y2 and 3 dot array. 21 00:02:18,700 --> 00:02:20,580 So arrays a function. 22 00:02:20,890 --> 00:02:23,010 This is a function of num by packet. 23 00:02:23,020 --> 00:02:30,780 That's why we have to write and be so in the first statement be in story number as empty. 24 00:02:30,820 --> 00:02:35,920 That's why we have to write and be before every function of this name by a package. 25 00:02:35,920 --> 00:02:44,110 That's why I will write and be bought at a and then in the brackets we will input that list as you remember 26 00:02:44,110 --> 00:02:47,090 the list are covered by its good record. 27 00:02:47,140 --> 00:02:56,320 So in the squared record we will write the list one common 2 common 3 form of 4 we enter the right and 28 00:02:56,320 --> 00:02:59,530 B and then run this. 29 00:02:59,710 --> 00:03:06,950 You can see the output is showing us at a which contains element 1 2 3 and 4. 30 00:03:11,570 --> 00:03:20,070 With write type of n B1 the U.S. output is the number by and b at a to create a matrix. 31 00:03:20,070 --> 00:03:26,400 You have to pass two lists on their set list in which there are two lists. 32 00:03:26,400 --> 00:03:32,890 So I will write my plan equal to empire and without a 33 00:03:36,090 --> 00:03:41,040 parenthesis will write a mess certain lists which contain two lists 34 00:03:49,920 --> 00:04:00,900 if fit on this will get done matrix you can see this a day in which our first story is this which contains 35 00:04:00,900 --> 00:04:12,280 element 1 in 2 and the second voice 3 4 or NDP 1 is in one dimensionality whereas my one is that two 36 00:04:12,280 --> 00:04:22,430 dimensionality to look at the shape of these two arrays will write and be one dot shape dot shape is 37 00:04:22,430 --> 00:04:25,970 a keyword that will give us the shape of the story. 38 00:04:26,390 --> 00:04:29,600 So and p 1 is our single language analogy. 39 00:04:29,670 --> 00:04:31,430 It contains only four elements. 40 00:04:31,430 --> 00:04:33,320 If we write Maitland or chip 41 00:04:39,380 --> 00:04:44,150 so you can see that this is a matrix which contains doodles and two columns 42 00:04:46,870 --> 00:04:53,710 unlike Python lists in which you can combine multiple types of elements and num by array you have to 43 00:04:53,890 --> 00:05:01,490 insert only similar types of element to get the type of elements of an empire. 44 00:05:01,690 --> 00:05:08,290 You have to write B type so I write my one dot B type 45 00:05:11,430 --> 00:05:18,020 it will give me the type of data elements in my might one day. 46 00:05:18,090 --> 00:05:22,730 You can see the elements are in Deja 47 00:05:26,000 --> 00:05:30,380 I can change the value of element by just using equal to operator. 48 00:05:30,410 --> 00:05:31,760 So if I write Magdalen 49 00:05:35,160 --> 00:05:36,320 square record. 50 00:05:36,780 --> 00:05:43,320 So my first element is 0 1 0 8 0 1 0 equate to 5 51 00:05:46,370 --> 00:05:51,460 it will assign the first element of value 5 so it failed. 52 00:05:51,580 --> 00:05:56,180 You can see that first and then it does not change to 5 instead of one earlier. 53 00:05:58,080 --> 00:06:05,610 If I tried to assign some string value to this idea we will get an error because as I said earlier on 54 00:06:05,610 --> 00:06:13,900 the elements of number it should we have same type so you can see we are getting an added because although 55 00:06:13,910 --> 00:06:20,940 that element out of paper and digit and we cannot pass a string and they went into this number I added. 56 00:06:20,960 --> 00:06:30,930 That's why we are getting them at least we use the function range to generate numbers in the sequence 57 00:06:31,730 --> 00:06:33,180 number array. 58 00:06:33,480 --> 00:06:44,120 We can use a function a range similar to gendered elements so for example if I won a new variable made 59 00:06:44,160 --> 00:06:48,920 to equal to now I want it to start from zero to 10. 60 00:06:49,040 --> 00:06:53,660 With that is type of 1 I write and be dot e range 61 00:06:59,060 --> 00:07:09,290 and then this output which is 0 comma the end point which is then comma is step which is 1 fight on 62 00:07:09,290 --> 00:07:11,710 this. 63 00:07:12,530 --> 00:07:21,180 You can see that no matter the events on the values from 0 to 9 that the stopping point is excluded. 64 00:07:21,560 --> 00:07:23,370 But the starting point is included. 65 00:07:24,780 --> 00:07:30,690 Similarly if we want to include both the elements both the starting point and the stopping point we 66 00:07:30,690 --> 00:07:39,090 have to use limited space function so we'll write Mark 3 if what you do and we don't space 67 00:07:46,030 --> 00:07:53,290 what is starting point is zero hour ending point is spent here instead of the steps we have to mention 68 00:07:53,290 --> 00:07:54,950 the number of elements we want. 69 00:07:55,090 --> 00:07:59,160 So if we won by the elements we operate point B. 70 00:08:00,370 --> 00:08:10,560 If we see we have 90 elements for between our starting point and the ending point if the other is coming 71 00:08:10,560 --> 00:08:13,140 in the form of metrics. 72 00:08:13,410 --> 00:08:19,350 But if we find out the shape of this you can see that this is only a one name externality can see that 73 00:08:19,350 --> 00:08:22,380 our finding limits and this lower damage Naledi 74 00:08:26,520 --> 00:08:29,090 now to generate random metrics. 75 00:08:29,280 --> 00:08:36,260 We can do that by using and b dot random dot grained 76 00:08:41,640 --> 00:08:42,070 here. 77 00:08:42,100 --> 00:08:45,850 We have specified the number of columns and number of rows. 78 00:08:45,940 --> 00:08:52,990 For example if we won five rows and five columns we can write five comma five to do this. 79 00:08:54,910 --> 00:09:00,940 We view our matrix for content random number between 0 and 1. 80 00:09:01,240 --> 00:09:04,660 And this is a 5 by 5 matrix. 81 00:09:04,670 --> 00:09:08,330 Now if we want the normally distributed random numbers 82 00:09:15,840 --> 00:09:20,790 can do this by choosing random dot brand and 83 00:09:24,030 --> 00:09:36,050 get it off by. 84 00:09:36,180 --> 00:09:43,080 There are other functions as well to create metrics such as and b DIAC will create our diagonal metrics 85 00:09:43,170 --> 00:09:51,300 in which only the elements of the diagonal have the value and b 0 will create a and b matrix in which 86 00:09:51,330 --> 00:09:59,160 all the elements are 0 and b dot ones will create a matrix in which all the elements of value when we 87 00:09:59,160 --> 00:10:01,350 are not discussing this right now. 88 00:10:01,680 --> 00:10:03,180 You can explode this on your own 89 00:10:15,840 --> 00:10:18,720 now just like in the list of strings. 90 00:10:18,720 --> 00:10:22,900 We can also use slices using the index number. 91 00:10:23,110 --> 00:10:26,710 So for example if we write my 5 92 00:10:29,530 --> 00:10:30,550 0 0 1 0 93 00:10:34,500 --> 00:10:43,480 it couldn't given me the first element but in this matrix fight if I write my 5 0 call my 1 94 00:10:47,680 --> 00:10:50,230 it will give me that element from the first row. 95 00:10:50,270 --> 00:10:54,660 That is the 0 rule with index 0 in the second column. 96 00:10:54,800 --> 00:11:03,450 That is the column with and next month I'm getting this value as out if I want to select all this value. 97 00:11:03,560 --> 00:11:07,350 That means all the values from first three rows. 98 00:11:07,370 --> 00:11:09,140 I will write my five 99 00:11:14,760 --> 00:11:16,110 zero column three 100 00:11:19,550 --> 00:11:22,830 comma for then. 101 00:11:22,850 --> 00:11:25,540 This means all the columns. 102 00:11:26,090 --> 00:11:31,550 If I run this I'm getting all the elements where the index is 0 1 or 2. 103 00:11:31,550 --> 00:11:33,370 Remember 3 is excluded. 104 00:11:33,800 --> 00:11:39,610 So we are getting a row with zero index or with one index well with index. 105 00:11:39,890 --> 00:11:47,390 Since we have created all and that means all the columns that we are getting all the columns data metric 106 00:11:47,500 --> 00:11:52,320 operations for the by adding also but we are not discussing it right now. 107 00:11:52,450 --> 00:11:54,190 One more one to find us.