python - Minor of matrix -


i'm writing in function computing minor of matrix

def minor(arr,i,j):     return arr[np.array(range(i)+range(i+1,arr.shape[0]))[:,np.newaxis],                  np.array(range(j)+range(j+1,arr.shape[1]))] 

and apply array initialized:

for row in values_float:     item in row:         am[p][k] = item 

but i'm getting error:

attributeerror: 'list' object has no attribute 'shape' 

does know why got it?

i think best way initialize array in numpy numpy.ndarray or numpy.zeros instead of how did , you're initializing list.

http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -