numpy.char.less#
- char.less(x1, x2)[源代码]#
按元素返回 (x1 < x2).
与
numpy.greater不同,此比较首先从字符串末尾去除空白字符.提供此行为是为了向后兼容 numarray.- 参数:
- x1, x2str 或 unicode 的类数组
具有相同形状的输入数组.
- 返回:
- outndarray
布尔值的输出数组.
参见
equal,not_equal,greater_equal,less_equal,greater
示例
>>> import numpy as np >>> x1 = np.array(['a', 'b', 'c']) >>> np.char.less(x1, 'b') array([True, False, False])