rougier/numpy-100

Question # 35

areeb-h-qureshi opened this issue · 1 comments

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

Even with strict casting rules, all arrays are float arrays so I don't understand why np.divide would complain