Maksim Skurydzin
Maksim Skurydzin

Reputation: 10541

numpy.matrix manipulations

I have a question about numpy.matrix class. How can I perform such basic manipulations with matrices as adding, deleting and replacing rows and columns?

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

Upvotes: 0

Views: 315

Answers (1)

Steve Tjoa
Steve Tjoa

Reputation: 61044

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

Upvotes: 3

Related Questions