So in this lecture will cover important libraries of Python.
It is named by pandas and Seabourn so we will open our two parter on screen one new Python 3 non book
first will cover the name by number is the code numerical computing package in Python and that school
type is and B re also known as Num by array.
You can change the title of notable
end to this.
There is also an auto save feature in Dubai notebook so you don't have to worry about saving it.
Number of packages almost using in all numerical computation using Python and it provides high performance
vector metrics and higher dimensional root stock tips for by them.
It is implemented in C and Fortran and that's why it is much faster than Python and functions to use
numbers.
We need to import the module to import the module will write import number as and b
since we are using Anaconda.
There is no need to install this libraries all the important libraries are already installed using the
anaconda.
And if you are using Python you have to use weapons code in the command from the install this library
there are various ways to initialize the name by.
We can either convert existing Python this sortable or we can generate an umpire array using functions
like aiding and line space.
So let's start with numbering will create a variable and be one if y2 and 3 dot array.
So arrays a function.
This is a function of num by packet.
That's why we have to write and be so in the first statement be in story number as empty.
That's why we have to write and be before every function of this name by a package.
That's why I will write and be bought at a and then in the brackets we will input that list as you remember
the list are covered by its good record.
So in the squared record we will write the list one common 2 common 3 form of 4 we enter the right and
B and then run this.
You can see the output is showing us at a which contains element 1 2 3 and 4.
With write type of n B1 the U.S. output is the number by and b at a to create a matrix.
You have to pass two lists on their set list in which there are two lists.
So I will write my plan equal to empire and without a
parenthesis will write a mess certain lists which contain two lists
if fit on this will get done matrix you can see this a day in which our first story is this which contains
element 1 in 2 and the second voice 3 4 or NDP 1 is in one dimensionality whereas my one is that two
dimensionality to look at the shape of these two arrays will write and be one dot shape dot shape is
a keyword that will give us the shape of the story.
So and p 1 is our single language analogy.
It contains only four elements.
If we write Maitland or chip
so you can see that this is a matrix which contains doodles and two columns
unlike Python lists in which you can combine multiple types of elements and num by array you have to
insert only similar types of element to get the type of elements of an empire.
You have to write B type so I write my one dot B type
it will give me the type of data elements in my might one day.
You can see the elements are in Deja
I can change the value of element by just using equal to operator.
So if I write Magdalen
square record.
So my first element is 0 1 0 8 0 1 0 equate to 5
it will assign the first element of value 5 so it failed.
You can see that first and then it does not change to 5 instead of one earlier.
If I tried to assign some string value to this idea we will get an error because as I said earlier on
the elements of number it should we have same type so you can see we are getting an added because although
that element out of paper and digit and we cannot pass a string and they went into this number I added.
That's why we are getting them at least we use the function range to generate numbers in the sequence
number array.
We can use a function a range similar to gendered elements so for example if I won a new variable made
to equal to now I want it to start from zero to 10.
With that is type of 1 I write and be dot e range
and then this output which is 0 comma the end point which is then comma is step which is 1 fight on
this.
You can see that no matter the events on the values from 0 to 9 that the stopping point is excluded.
But the starting point is included.
Similarly if we want to include both the elements both the starting point and the stopping point we
have to use limited space function so we'll write Mark 3 if what you do and we don't space
what is starting point is zero hour ending point is spent here instead of the steps we have to mention
the number of elements we want.
So if we won by the elements we operate point B.
If we see we have 90 elements for between our starting point and the ending point if the other is coming
in the form of metrics.
But if we find out the shape of this you can see that this is only a one name externality can see that
our finding limits and this lower damage Naledi
now to generate random metrics.
We can do that by using and b dot random dot grained
here.
We have specified the number of columns and number of rows.
For example if we won five rows and five columns we can write five comma five to do this.
We view our matrix for content random number between 0 and 1.
And this is a 5 by 5 matrix.
Now if we want the normally distributed random numbers
can do this by choosing random dot brand and
get it off by.
There are other functions as well to create metrics such as and b DIAC will create our diagonal metrics
in which only the elements of the diagonal have the value and b 0 will create a and b matrix in which
all the elements are 0 and b dot ones will create a matrix in which all the elements of value when we
are not discussing this right now.
You can explode this on your own
now just like in the list of strings.
We can also use slices using the index number.
So for example if we write my 5
0 0 1 0
it couldn't given me the first element but in this matrix fight if I write my 5 0 call my 1
it will give me that element from the first row.
That is the 0 rule with index 0 in the second column.
That is the column with and next month I'm getting this value as out if I want to select all this value.
That means all the values from first three rows.
I will write my five
zero column three
comma for then.
This means all the columns.
If I run this I'm getting all the elements where the index is 0 1 or 2.
Remember 3 is excluded.
So we are getting a row with zero index or with one index well with index.
Since we have created all and that means all the columns that we are getting all the columns data metric
operations for the by adding also but we are not discussing it right now.
One more one to find us.