This is it. The ndarray data structure is the main data structure in NumPy, which stands for n-dimensional array. It is a homogeneous, multi-dimensional array of fixed-size elements, where each element is of the same data type.

“The basic ndarray (data structure) is created using an array function in NumPy. It takes a sequence of elements and creates a one-dimensional ndarray with them. A sequence, in the context of ndarray, is any iterable object producing the array elements. For example, a list or a tuple is an iterable object.” (NumPy documentation, p. 6)

Here is an example of creating a NumPy ndarray with the array() function:


   import numpy as np
   my_array = np.array([[1, 2, 3], [4, 5, 6]])
   print(my_array)

This will output:


   array([[1, 2, 3],
          [4, 5, 6]])

In this example, my_array is a two-dimensional ndarray with shape (2, 3), where each row represents a list of integers.

To sum up, ndarray objects are used extensively in data science applications because they provide a way to store and manipulate large amounts of data efficiently. They offer a wide range of methods and functions for working with arrays, including mathematical operations, statistical analysis, and linear algebra.

Leave a Reply