1
A
回答
13
a[1:-1, 1:-1]
5
一個更普遍的回答是:
a[[slice(1, -1) for _ in a.shape]]
相關問題
- 1. 如何結合兩個python矩陣numpy
- 2. Python numpy矩陣賦值
- 3. 的Python,numpy的,矩陣
- 4. Python NumPy:如何使用方程填充矩陣
- 5. Python矩陣乘法; numpy的陣列
- 6. 通過使用scipy/numpy在Python中添加2矩陣和乘法2矩陣
- 7. Python numpy矩陣乘以一個對角矩陣
- 8. 如何在Python中爲每個2D截面填充2D矩陣的4D矩陣
- 9. 矩陣的可變大小[ixj](Python,Numpy)
- 10. 創建特殊矩陣的Python/numpy的
- 11. 數組中的numpy矩陣-python
- 12. python numpy:計算跨矩陣的行
- 13. 在Numpy/Python中快速稀疏矩陣
- 14. 將numpy矩陣轉換爲python數組
- 15. 使用另一個矩陣對NumPy矩陣進行子集
- 16. 使用2D矩陣作爲numpy 3D矩陣的索引?
- 17. Numpy Hermitian矩陣類
- 18. 如何在python中使用矩陣?
- 19. 如何使用joblib Python返回矩陣?
- 20. numpy:如何從矩陣向量構造向量矩陣
- 21. 使用numpy更改矩陣的形狀
- 22. 使用numpy縮小矩陣的大小
- 23. 如何製作numpy數組的矩陣?
- 24. 在Python中使用scipy/numpy計算2D矩陣的z分數
- 25. 使用numpy在python中存儲可變數量的矩陣
- 26. 使用Python添加隨機矩陣與Numpy
- 27. 非常大的矩陣使用Python和NumPy
- 28. Python:如何消除numpy中矩陣的所有零行
- 29. 如何行或列添加到Python中的矩陣numpy的
- 30. Python Numpy - 附加三個陣列形成矩陣或3D陣列
也就是說飛馳緊湊!我以前只使用slice(1,-1)對象的元組來看過這個。 – 2008-12-13 17:21:27