Answer the question
In order to leave comments, you need to log in
How to pull the first element from a numpy.matrix?
Hello!
There is a matrix np.matrix, for example, of the form:
M = np.matrix()
for i in M:
coeff_a_from_M = i[0][0]
print('coeff_a_from_M: ', coeff_a_from_M)
coeff_a_from_A:
Answer the question
In order to leave comments, you need to log in
import numpy as np
M = np.matrix()
print(M[0,0])
for idx, el in enumerate(M):
coeff_a_from_M = el[0][0]
print(idx, '-->', el, '-->', el[0], '-->', coeff_a_from_M)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question