I have an array A. I want to sum all the positive elements of each row of A. I present the current and expected output.
import numpy as np A=np.array([[0,-2,3],[1,0,6],[7,8,0]]) B1=[] for i in range(0,len(A)): B=np.sum(A[i]>0) B1.append(B) print(B1) The current output is
[1, 2, 2] The expected output is
[3,7,15]