All right, so sometimes you're looking for a specific shape, you might want an array of zeros or ones
empty, you might want random numbers in there, and all of that is possible.
So first, let's just do zeros, so d equals and p dot zeros.
So this is the zeros function and then square brackets and they're inside of the parentheses.
And let's just say we want a two by three.
So D and then when we run that you're going to get an array two by three all zeros.
Same idea, if you want one.
Let's do a equals and Peter ones.
And I'd say three by three.
He.
And then we'll run that, so you get exactly the shape that you want in the first case of zeros and
in the second case, once sometimes you might want random numbers, an array of random numbers, so
you can do that as well.
So let's do NPR dot random dot rand and then you just need the parentheses and.
Let's say five by three.
And there is your random array that has five rows and three columns.
Now both the zeros and ones functions take in the same parameters.
So you might be interested in, for example, let me go to the zeros one here.
I might be interested in using the D-type type or data type parameter.
It is optional, as you see.
Of course, we didn't use it up here and we didn't get any error.
That is because it's optional, but you might be interested, for example, in using an input and you
can do that just like this.
So let's say an int 64.
And there is also a parameter order.
So right now we're using by default see see the C argument and this is called the row major or the sea
style.
But we can also use what's called the column major or the FORTRAN style in memory.
And to do that, you would just do order equals and then in single or double quotation marks f you would
choose the option F.
But this, along with data type, are both optional.
Finally, the full function is really useful as well.
It's very similar to the ones and zeroes functions, but it has an extra parameter that's really useful.
It's called fill underscore value, and let's try to use it here and I'll just do F equals and p dot
full.
And then I can say that I want a two by two so I can tell its shape.
But then I can do a comma and say that I want 10s in there so I can just do 10.
And then we can run that.
So we have a two way to two rows, two columns with tens instead of zeros or ones.
So one final example with the full function here, let's say I want a three dimensional array that's
two by two by three.
So I'll just do F equals and P Dot for opening parentheses, opening parentheses, two comma, two comma,
three close in parentheses, comma and then square brackets.
Let's say I want four comma, two comma, three close and square brackets closing parentheses and then
f and there we are.
So great, really useful when you need to specify both the shape and specific values when ones and zeros
want to see you in the next lecture.