2017-01-05 5 views
1
>import numpy as np 

>a = np.arange(15).reshape(3, 5) 

([[ 0, 1, 2, 3, 4], 

[ 5, 6, 7, 8, 9], 

[10, 11, 12, 13, 14]]) 

> a.shape 
(3, 5) 

> a.ndim 
2 /// how to calculate it for any narray 

答えて

1

ndimあなたはサイズの大きさ3と第2の最初の2次元、5

を持っているあなたのケースで len(a.shape)

と同じです

関連する問題