Python matrix problems -


this continued thread: python matrix, solution?


input

from numpy import * import numpy  x=[['1','7'],  ['1.5', '8'],  ['2', '5.5'],  ['2','9']] 

code

y = x[:, :, none] * x[:, none] print y.sum(axis=0) 

i received error:

"list indices must integers, not tuple"

but if x x = numpy.array([[1, 7], [1.5, 8], [2, 5.5], [2, 9]]) it's ok, don't have such input.

convert x numpy array of numbers:

x = numpy.asanyarray([[float(z) z in y] y in x]) 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -