The char.greater_equal() function in Python is used to check, one by one, if the elements of array x1 are greater than or equal to the elements of another array x2 of the same shape. It returns True if x1 is greater than or equal to x2 and False if otherwise.
char.greater_equal(x1, x2)
The char.greater_equal() function takes two parameter values, x1 and x2, which are the two input arrays of the same shape.
The char.greater_equal() function returns an output array of boolean values.
Let’s look at the code below:
import numpy as np# creating input arraysmyarray1 = np.array(['1', '10', '122'])myarray2 = np.array(['1', '13', '121'])# printing the arraysprint(myarray1)print(myarray2)# implementing the char.greater_equal() function on both arrays to see if they are equalprint(np.char.greater_equal(myarray1, myarray2))
numpy module.myarray1 and myarray2 using the array() function.myarray1 and myarray2.char.greater_equal() function on both arrays to check if the elements in myarray1 are greater than or equal to the elements in myarray2. We print the result to the console.