
上QQ阅读APP看书,第一时间看更新
Indexing
- Look up the values of the two-dimensional arrays with indexing:
array_1[0,0] #Finds value in first row and first column.
1
- View the first row:
array_1[0,:]
array([1, 2])
- Then view the first column:
array_1[:,0]
array([1, 3, 5, 7, 9])
- View specific values along both axes. Also view the second to the fourth rows:
array_1[2:5, :]
array([[ 5, 6],
[ 7, 8],
[ 9, 10]])
- View the second to the fourth rows only along the first column:
array_1[2:5,0]
array([5, 7, 9])