#194·numpy-100

Question # 35

Author: areeb-h-qureshiCreated Jan 23, 2023Updated Feb 2, 2023

With new casting rules, input arrays must be specified as a float inorder for np.divide to work. Otherwise casting of np.divide must be set to 'unsafe'

A = np.ones(3)*1 A.astype('float') # Possible fix B = np.ones(3)*2 B.astype('float') # Possible fix

np.divide(A,2,out=A, casting='unsafe') # Alternative Fix