rougier/numpy-100

Alternate solution to Q29

mohantyk opened this issue · 1 comments

Q29. How to round away from zero a float array

Solution:

Z = np.random.uniform(-10, 10, 10)
Z = np.where(Z>0, np.ceil(Z), np.floor(Z))
print(Z)

Your solution is correct but less efficient but more readable. Can you make PR (with a comment explaining it is less efficient) ?