Numpy library 01_ multi-dimensional matrix data structure

size, i.e. the number must be equal, or to the error # nparr7re = nparr7.reshape (5, -1) # -1 represents inferred to be able to be introduced to give the amount of # print (nparr7re) # # bulk data open: ravel (), without changing the original data # nparr7rera = nparr7re.ravel () # [1 2 3 4 5 4 5 6 7 8] # print (nparr7rera) # # flattening data: flatten () function and data spread the same as if # nparr7refla = nparr7re.flatten () # [1 2 3 4 5 4 5 6 7 8] # print (nparr7refla) # data merge: concatenate ([arr1, arr2], axis = 0) # arr1 = np. arange (0,9) .reshape (3,3) # arr2 = np.arange (9,18) .reshape (3,3) # arr5 = np.arange (19,28) .reshape (3,3) # arr3 = np.concatenate ([arr1, arr2, arr5], axis = 0) #y shaft combined, this is the default, two ARR can be a plurality of # arr4 = np.concatenate ([arr1, arr2, arr5], axis = 1) #x shaft combined # print (arr3) # print (arr4) # split the data: np.split (arr, [x, y]) # arr7 = [[1,2,3,4], [ 4,5,6,7]] # nparr7 = np.array (arr7) # print (nparr7) # nparr8 = np.split (nparr7, [2,2]) # unsuccessful, # print (nparr8) # print ( nparr7) # transposed data and swap shaft # nparr9 = np.arange (0,12) .resha pe (3,4) # print (nparr9) # nparr10 = nparr9.

Guess you like

Origin www.cnblogs.com/yiyea/p/11441741.html