numpy.char.not_equal#
- char.not_equal(x1, x2)[source]#
逐元素返回 (x1 != x2)。
與
numpy.not_equal
不同,此比較會先去除字串末尾的空白字元。此行為是為了向後相容於 numarray 而提供的。- 參數:
- x1, x2str 或 unicode 的類陣列 (array_like)
相同形狀的輸入陣列。
- 返回:
- outndarray
布林值的輸出陣列。
參見
範例
>>> import numpy as np >>> x1 = np.array(['a', 'b', 'c']) >>> np.char.not_equal(x1, 'b') array([ True, False, True])