Skip to content Skip to sidebar Skip to footer

"built-in Method Sum" Weird Message When Printing A Sum

Using Python NumPy to calculate the sum of the column of a matrix: import numpy from StringIO import StringIO fileName = 'test2.csv' myFile = open(fileName,'r') print 'Reading dat

Solution 1:

You have to make a call of the sum function. Just replace this piece of code:

sumA1 = data[:,2].sum

with this one:

sumA1 = data[:,2].sum()

Post a Comment for ""built-in Method Sum" Weird Message When Printing A Sum"