numpy.sign() in Python
#Use numpy sign method will return array with corresponding signs
import numpy as np
arr = np.array([-10, 0, 15])
print(np.sign(arr)) # will return [-1, 0, 1]
numpy.sign() in Python
#Use numpy sign method will return array with corresponding signs
import numpy as np
arr = np.array([-10, 0, 15])
print(np.sign(arr)) # will return [-1, 0, 1]
numpy sign method
# sign method return 0 if the values in the array is 0,
# 1 is the value is greater than 0
# and -1 when the value is less than 0
import numpy as np
arr = [-10, 0, 15]
print(arr.sign) # will return [-1, 0, 1]
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us