June 2015
Beginner
348 pages
8h 44m
English
Let's call the first four methods on the add() function:
add() function, the result of reducing is similar to calculating the sum of an array. Call the reduce() method:a = np.arange(9)
print("Reduce", np.add.reduce(a))The reduced array should be as follows:
Reduce 36
accumulate() method also recursively goes through the input array. But, contrary to the reduce() method, it stores the intermediate results in an array and returns that. The result, in the case of the add() function, is equivalent to calling the cumsum() function. Call the accumulate() method on the ...Read now
Unlock full access