We are going to discuss 2 of them in detail which generally comes in use.
A.) Converting Python array_like Objects to Numpy Arrays:
So, in this what we do is simply take the existing python data structures like list, tuples and will convert them to Numpy array using array function of Numpy like np.array(<list>).
How to create an array using existing data structure of python such as list, tuple, asrray method
B.) Intrinsic Numpy array creation objects:
Numpy has built-in functions to create an array from scratch.
1. zeros(shape): It is a function which will create an array filled with 0 values with the specified shape. The default dtype is float64.
2. ones(shape): It is a function which will create an array filled with 1’s with the specified shape. Rest of the properties are same as of zeros(shape).
3. arange(): It is a function which will create an array by regularly incrementing values. We will discuss different parameters of function below with the help of an example and for the detailed information, you can refer to the documentation of Numpy.
4. linspace(): It is a function which will generally take 3 parameters (beginning value, end value, space between each value). It will be more clear to you through an example.