我是python的新手。如果這個問題看起來新手,請不要對我苛刻。我創造了這樣一個矩陣:無法訪問矩陣的元素
Matrix = np.matrix([[0,0,0,1], [0,0,1,1], [1,0,0,1], [1,1,0,0],[0,0,1,1]])
現在,當我嘗試訪問矩陣的元素,像這樣:
import numpy as np
print(Matrix[0][3])
我收到以下錯誤:
IndexError: index 1 is out of bounds for axis 0 with size 1
我已經通過了stackoverflow上的所有相關帖子,但到目前爲止還沒有找到解決方案。
爲什麼搜索的SO,而不是堅持到[官方文檔(https://開頭docs.scipy.org/doc/numpy-dev/user/quickstart.html)? – sascha
[在numpy/scipy中切片數組]可能重複(http://stackoverflow.com/questions/2725750/slicing-arrays-in-numpy-scipy) –
@MuhammadUsman我正在嘗試打印Matrix的元素。我不想分割矩陣。 –