I wish to divide an array numerators by an array denominators, but some elements in denominators may be zero. The resulting element at those indices should be zero as well. Is there a function in NumPy which picks elements from numerators / denominators where denominators isn't zero, and from a zero array otherwise?
I looked into boolean masking, but that would take multiple lines, since I would have to mask denominators in order to not get any division-by-zero errors, as well as the result in order to set those elements to zero.
I could swear I've seen such a function but I can't find it anymore.
 
     
    