numpy.core.defchararray.greater_equal(arr1, arr2)
是另一個在numpy中執行字符串操作的函數。它一一檢查兩個相同形狀的字符串數組的元素,如果其中的元素返回Truearr1
大於或等於的元素arr2
即arr1 >= arr2
否則返回假。
參數:
arr1 :str或unicode的數組。第一個輸入數組。
arr2 :str或unicode的數組。第二個輸入數組。
返回:[ndarray] bool的輸出數組;如果arr1和arr2是標量,則為單個bool。
代碼1:
# Python program explaining
# numpy.char.greater_equal() method
# importing numpy
import numpy as geek
# input arrays
in_arr1 = geek.array('numpy')
print ("1st Input array:", in_arr1)
in_arr2 = geek.array('nump')
print ("2nd Input array:", in_arr2)
# checking if in_arr1 >= in_arr2
out_arr = geek.char.greater_equal(in_arr1, in_arr2)
print ("Output array:", out_arr)
輸出:
1st Input array: numpy 2nd Input array: nump Output array: True
代碼2:
# Python program explaining
# numpy.char.greater_equal() method
# importing numpy
import numpy as geek
# input arrays
in_arr1 = geek.array(['Geeks', 'for', 'Geek', 'Numpy'])
print ("1st Input array:", in_arr1)
in_arr2 = geek.array(['Geek', 'for', 'Geek', 'numpy'])
print ("2nd Input array:", in_arr2)
# checking if in_arr1 >= in_arr2
out_arr = geek.char.greater_equal(in_arr1, in_arr2)
print ("Output array:", out_arr)
輸出:
1st Input array: ['Geeks' 'for' 'Geek' 'Numpy'] 2nd Input array: ['Geek' 'for' 'Geek' 'numpy'] Output array: [ True True True False]
代碼3:
# Python program explaining
# numpy.char.greater_equal() method
# importing numpy
import numpy as geek
# input arrays
in_arr1 = geek.array(['10', '11', '122', '15'])
print ("1st Input array:", in_arr1)
in_arr2 = geek.array(['10', '13', '121', '141'])
print ("2nd Input array:", in_arr2)
# checking if in_arr1 >= in_arr2
out_arr = geek.char.greater_equal(in_arr1, in_arr2)
print ("Output array:", out_arr)
輸出:
1st Input array: ['10' '11' '122' '15'] 2nd Input array: ['10' '13' '121' '141'] Output array: [ True False True True]
相關用法
- Numpy string less()用法及代碼示例
- Numpy string isspace()用法及代碼示例
- Numpy string isdigit()用法及代碼示例
- Numpy string isdecimal()用法及代碼示例
- Numpy string isalpha()用法及代碼示例
- Numpy string translate()用法及代碼示例
- Numpy string zfill()用法及代碼示例
- Numpy string swapcase()用法及代碼示例
- Numpy string isnumeric()用法及代碼示例
- Numpy string istitle()用法及代碼示例
- Numpy string islower()用法及代碼示例
- Numpy string lower()用法及代碼示例
- Numpy string title()用法及代碼示例
- Numpy string rjust()用法及代碼示例
- Numpy string upper()用法及代碼示例
注:本文由純淨天空篩選整理自jana_sayantan大神的英文原創作品 numpy string operations | greater_equal() function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。