Applying A Function To A Numpy Array