0
How to manipulate an element of my choice in a multidimensional array in NumPy?
I have a matrix which consists five matrices. I like to change a particular element in the inner matrix.
3 Answers
+ 2
Hopefully, this makes it clearer. This has 5 matrices, each 2x2, and we are modifying a chosen element. If you were looking to access or manipulate it in a different way, please clarify and the example can be adjusted appropriately.
https://code.sololearn.com/c76Xy0Q5tnrF
+ 1
Typically access is by row then column within your matrix.
For example, in the following 3x3 matrix, you can access the last column of the second row as follows.
import numpy as np
ar = np.array([[1,2,3],[4,5,6],[7,8,9]])
print(ar[1][2])
If you have additional dimensions, they are indexed the same way: ar[0][1][2] is the last column of the second row in the first matrix.
0
I didn't get your point. please, elaborate again