Search⌘ K

Multidimensional Arrays

Explore the creation and manipulation of multidimensional arrays using NumPy in Python. Understand how to define arrays, use meshgrid for coordinate grids, reshape arrays, and learn about important array properties like size, shape, and data type to enhance scientific computing skills.

Creation #

Arrays may have arbitrary dimensions as long as they fit in your computer’s memory. Multidimensional arrays, commonly known as matrices in Python, can be created with any of the methods given in the previous lesson by specifying the number of rows and columns in the array.

Note that the number of rows and columns must be a tuple (so they need to be between parentheses), because the functions expect only one input argument for the shape of the array, which may be either one number or a tuple of multiple numbers.

Python 3.5
import numpy as np
x = np.ones((3, 4)) # An array with 3 rows and 4 columns
print(x)

The code above results in the creation of a 3×43 \times 4 ...