size計算矩陣中所有元素的個數;
.shape返回維度值,返回一個元組
len()可以想象成數據長度/條數,即數據的行數
輸入:
a = np.array([[1, 2, 3, 4], [1, 2, 3, 4]])
print(len(a))
print(a.size)
print(a.shape)
輸出:
2
8
(2, 4)
參考博客(侵刪):
https://blog.csdn.net/peggiehu/article/details/107004480
https://blog.csdn.net/chen_swith/article/details/107633829?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_title-2&spm=1001.2101.3001.4242