Python: Setting an element of a Numpy matrix
I am a pretty new to python. I have created an empty matrix
a = numpy.zeros(shape=(n,n))
Now I can access each element using
a.item(i,j)
Ho开发者_如何学JAVAw do I set an index (i,j)?
Here's how:
a[i,j] = x
Or
a.itemset((i,j),x)
Try this
a[i,j]=5
精彩评论