Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

calculate histogram for each row of an array

I have a 2d array and I want to calculate the histogram for each row of the array without the 'for' loop. This is what I've already tried before.

data=np.random.randint(1,10,size=(40000,2000)
h=np.zeros(data.shape[0],9)
for i in range(data.shape[0])
     h[i],k=np.histogram(data[i,:],bins=range(1,11))

Comments