why is numpy where keep raising divide by zero encountered?
Since it takes advantages of vectorization , it will execute 100/np.sqrt(w)for  every element of w , so the division by 0 will happen , but then you are not taking the results associated with these entries. So basically with your trick you are still dividing by 0 but not using the entries where you divided by 0.
I have an array like w=[0.854,0,0.66,0.245,0,0,0,0] and want to apply 100/sqrt(x) on each value. As I can't divide by 0, I'm using this trick :
w=np.where(w==0,0,100/np.sqrt(w))
As I'm not dividing by 0, I shouldn't have any warning.
So why does numpy keep raising RuntimeWarning: divide by zero encountered in true_divide ?