NumPy 數組屬性

ndarray對象的屬性 ndarray.ndim ndarray.ndim 用於返回數組的維數,等於秩。 import numpy as np a = np.arange(24) print (a.ndim) # a 現只有一個維度 # 現在調整其大小 b = a.reshape(2,4,3) # b 現在擁有三個維度 print (b.ndim) 輸出結果爲
相關文章
相關標籤/搜索