From the course: NumPy Essential Training: 1 Foundations of NumPy
Unlock the full course today
Join today to access over 24,600 courses taught by industry experts.
Intrinsic NumPy array creation
From the course: NumPy Essential Training: 1 Foundations of NumPy
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Array types and conversions between types4m 25s
-
(Locked)
Multidimensional arrays3m 7s
-
(Locked)
Creating arrays from lists and other Python structures3m 36s
-
(Locked)
Intrinsic NumPy array creation5m 33s
-
(Locked)
Creating arrays filled with constant values4m 41s
-
(Locked)
Finding the shape and size of an array2m 50s
-
-
-
-