【NumPy學習】03: 數組屬性

import numpy as np #1 ndarray.ndim 用於返回數組的維數,等於秩。 a1 = np.arange(24) print(a1.ndim) # a 現只有一個維度 # 如今調整其大小 # reshape(self, shape, order) b1 = a1.reshape(2,4,3) # b 如今擁有三個維度 print(b1.ndim) #2 ndarr
相關文章
相關標籤/搜索