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

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…

Contents