我对 python 中的索引有点困惑。我有以下数组
[[ 2 4]
[ 6 8]
[10 12]
[14 16]]
我想获得 array([4, 2]) 作为我的输出。我尝试使用
Q4= [Q3[0,1],Q3[0,0]]
我的输出结果为 [4, 2]。我缺少“数组”(“关于 Python 中索引的任何指针?谢谢!!
最佳答案
只需将第一行反转即可:
Q3[0,::-1]
array([4, 2])
关于numpy - 在 Numpy 中索引多维数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75278070/