开发者

numpy.matrix manipulations

I have a question about numpy.matrix class. How can I perform such basic manipulations with mat开发者_JAVA百科rices as adding, deleting and replacing rows and columns?

p.s. I apologize for the lame question..


Perfectly fine question! Try examining this code:

import scipy
X = scipy.rand(3,3)
Y = scipy.rand(3,3)
print X+Y
print scipy.delete(X, 1, 0)
print scipy.delete(X, 1, 1)
X[1,:] = [1,2,3]
print X

For more, see the numpy/scipy docs here: NumPy/SciPy docs

If you are fluent in Matlab, this page is useful: NumPy for Matlab Users

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜