From the course: NumPy Essential Training: 1 Foundations of NumPy
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Multidimensional arrays
From the course: NumPy Essential Training: 1 Foundations of NumPy
Multidimensional arrays
- [Instructor] As we have seen, the NumPy array called ndarray is the central object of the NumPy package. We have learned how to manually create one-dimensional array. Creating two-dimensional and three-dimensional arrays is also easily done. One-dimensional array can be thought of as a vector, a two-dimensional array as a matrix, and a three-dimensional array as a tensor. Even if you need more than three dimensions, it's simply with NumPy building functions. To define a two-dimensional array, we will use the np.array function as we have already done with one-dimensional arrays. Let's import NumPy as np. To define a two-dimensional array, we will use the np.array function as we have already done with one-dimensional arrays. Let's create it by typing nums = np.array, but this time add two elements. Each element is a one-dimensional list. First one will contain integers from one to five and the second one from six to 10. Let's see how we can access the first element in the top left…
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
-
-
-
-