-2
-2
np.zeros()
Note: The main purpose of using these functions is to initialize variables with
the right-sized Numpy array. Then, you can fill the arrays in your code with
valuesduring your program execution.
Creating numpy arrays with pre-filled values
np.arange(start,end, increment)
np.linspace(start,end,number)
Most often, you will either read data from a spreadsheet table (or another 2-dim
data set) that creates 2-dimensional (or higher) dimensional arrays for you.
However, one often needs to also create variables that we can assign data and
store them in 2-dimensional arrays.
2-dimensional arrays examples:
Examples for 2-dimensional data arrays:
• Delta Airlines offers a price matrix for your flights when you choose flexible dates.
2-dimensional arrays examples:
We need two indices:
np.empty(shape=[2,3]) first index is the number
of rows, second index
the number of columns
np.zeros(shape[5,1])
It is a simplified version of a[2:len(a):2,0:len(a):2]