From the course: NumPy Essential Training: 1 Foundations of NumPy

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Intrinsic NumPy array creation

Intrinsic NumPy array creation

- [Instructor] Creating arrays using the array function would be tedious if we wanted to create large arrays. Fortunately, NumPy has a few helpful functions that can create arrays filled with values. One of these functions is arange. If you're familiar with Python, then you have used an equivalent function called range. If we pass one integer, we'll get a one-dimensional array of integers starting at zero and up to integer we've passed as a parameter. As usual, let's import NumPy as np and then create our first ndarray using the arange function. What we get is an array of integers. We can also use the arange function with a starting value other than zero by passing two arguments. One of them defines the start value, and the other defines the final value. Let's create our second ndarray using arange, starting value 100 and final value 130. Great. Let's use arange for our third ndarray. This time, we'll pass three arguments, first one defining start value, second one defining final…

Contents