Sum operation in numpy arrays

Ana Dionísio anadionisio257 at gmail.com
Thu May 2 05:10:11 EDT 2013


Hello! I have several numpy arrays in my script and i want to add them. For example:

a=[1,2,3,4,5]
b=[1,1,1,1,1]
c=[1,0,1,0,1]

for i in range(5):
    d[i]=a[i]+b[i]+c[i]

print d

[3,3,5,5,7]

I did it like that but I get an error: "TypeError: unsupported operand type(s) for +: 'float' and 'numpy.string_'"

How can I sum my arrays?



More information about the Python-list mailing list