There are several ways to create objects of ndarray type. The recipes in this chapter provide a comprehensive list of the possibilities.
Creating NumPy arrays
How to do it…
Let's move on to learn how an array can be created from a list.
Creating an array from a list
To create an array from an explicit list, use the following code:
x = np.array([2, 3.5, 5.2, 7.3])
This will assign to x the following array object:
array([ 2. , 3.5, -1. , 7.3, 0. ])
Notice that integer array entries are converted to floating point values. NumPy arrays are homogeneous, that is...