It looks like your ‘trainData’ is a list of strings:
[‘-214’ ‘-153’ ‘-58′ …, ’36’ ‘191’ ‘-37’]
Change your ‘trainData’ to a numeric type.
import numpy as np
np.array([‘1′,’2′,’3’]).astype(np.float)
When your are trying to apply prod on string type of value like:
[‘-214’ ‘-153’ ‘-58′ …, ’36’ ‘191’ ‘-37’]
you will get the error.
Solution:
Append only integer value like [1,2,3], and you will get your expected output.
If the value is in string format before appending then, in the array you can convert the type into int type and store it in a list.