开发者

numpy.matrix manipulations

开发者 https://www.devze.com 2022-12-21 23:25 出处:网络
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?

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

精彩评论

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