Hey @safa, you can use sign() function. Inorder to understand the function let consider this code snippet, the code uses the NumPy library and gives it alias to np . It creates an array and finds the sign of each element using the np.sign() function. It then takes the absolute value of each element using np.abs() , and rounds them up to the nearest integer using np.ceil() . Finally, it multiplies the sign of each element by the rounded-up absolute value to get the final array.
You can use the NumPy’s ceil() function which rounds each positive element of the array up to the next highest integer. This function returns the ceiling value of each element of the input array. Here is the code for it: