下面的示例數組,如何逐列分割以獲得以下內容(例如第3列)[0, 0, ..., 1338, 1312, 1502, 0, ...]
尋找最有效的方法,謝謝!切片numpy陣列獲得第n列
>>> r
array([[[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0]],
[[ 0, 0, 1338],
[ 0, 0, 1312],
[ 0, 0, 1502],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0]],
[[ 0, 0, 1400],
[ 0, 0, 1277],
[ 0, 0, 1280],
[ 0, 0, 0],
[ 0, 0, 0],
[ 0, 0, 0]]], dtype=uint16)
https://docs.scipy.org/doc/numpy-dev/user/quickstart.html# indexing-slicing-and-iterating –