Multiple ways to create ndarrays - matrices
import numpy as np
create1 = np.array([1,2,3,4]) ## creates a 1 dimensional array with 4 elements - takes input as 1 list
create1 = np.array([[1,2,3,4],[5,6,7,8]]) ## creates 2 dimensinal array -- takes input as 2 lists. notice the big square bracktes outside
create1 = np.array([[1,2,3,4],[5,6,7,8]..... [n1,n2,n3,n4]]) ## creates n dimensinal array -- takes input as 2 lists.
create1 = np.arrange
# create a copy of ndarray
copy1 = np.array(create1) # this will create a new copy of array instead of assigning refrence to it
Comments
Post a Comment