a :jgK @ sT d Z ddlZddlmZ ddlmZmZmZ ddlm Z m ZmZ ddlmZ dd lmZ dd lT ddlmZ ddlmZmZmZmZmZm Z! g d Z"ej#ej$ddZ$dd Z%e$e%dd Z&e$e%dd Z'e$e%dd Z(e$e%dd Z)e$e%dd Z*e$e%dd Z+dd ZedG d d! d!e Z,edd'd#d$Z edd(d%d&ZdS ))an This module contains a set of functions for vectorized string operations and methods. .. note:: The `chararray` class exists for backwards compatibility with Numarray, it is not recommended for new development. Starting from numpy 1.4, if one needs arrays of strings, it is recommended to use arrays of `dtype` `object_`, `bytes_` or `str_`, and use the free functions in the `numpy.char` module for fast vectorized string operations. Some methods will only be available if the corresponding string method is available in your version of Python. The preferred alias for `defchararray` is `numpy.char`. N ) set_module )bytes_str_ character)ndarrayarrayasarraycompare_chararrays) overrides)*)multiply) _partition_rpartition_split_rsplit_splitlines_join)5equal not_equal greater_equal less_equalgreaterlessZstr_lenaddr mod capitalizecentercountdecodeencodeendswith expandtabsfindindexisalnumisalphaisdigitislowerisspaceistitleisupperjoinljustlowerlstrip partitionreplacerfindrindexrjust rpartitionrsplitrstripsplit splitlines startswithstripswapcasetitle translateupperzfill isnumeric isdecimalr r r chararrayz numpy.char)modulec C s | |fS N x1Zx2rH rH B/usr/local/lib/python3.9/site-packages/numpy/_core/defchararray.py_binary_op_dispatcher5 s rL c C s t | |ddS )ao Return (x1 == x2) element-wise. Unlike `numpy.equal`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : array_like of str or unicode Input arrays of the same shape. Returns ------- out : ndarray Output array of bools. Examples -------- >>> y = "aa " >>> x = "aa" >>> np.char.equal(x, y) array(True) See Also -------- not_equal, greater_equal, less_equal, greater, less z==Tr rI rH rH rK r 9 s r c C s t | |ddS )a Return (x1 != x2) element-wise. Unlike `numpy.not_equal`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : array_like of str or unicode Input arrays of the same shape. Returns ------- out : ndarray Output array of bools. See Also -------- equal, greater_equal, less_equal, greater, less Examples -------- >>> x1 = np.array(['a', 'b', 'c']) >>> np.char.not_equal(x1, 'b') array([ True, False, True]) z!=Tr rI rH rH rK r Z s r c C s t | |ddS )a Return (x1 >= x2) element-wise. Unlike `numpy.greater_equal`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : array_like of str or unicode Input arrays of the same shape. Returns ------- out : ndarray Output array of bools. See Also -------- equal, not_equal, less_equal, greater, less Examples -------- >>> x1 = np.array(['a', 'b', 'c']) >>> np.char.greater_equal(x1, 'b') array([False, True, True]) z>=Tr rI rH rH rK r { s r c C s t | |ddS )a Return (x1 <= x2) element-wise. Unlike `numpy.less_equal`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : array_like of str or unicode Input arrays of the same shape. Returns ------- out : ndarray Output array of bools. See Also -------- equal, not_equal, greater_equal, greater, less Examples -------- >>> x1 = np.array(['a', 'b', 'c']) >>> np.char.less_equal(x1, 'b') array([ True, True, False]) z<=Tr rI rH rH rK r s r c C s t | |ddS )a Return (x1 > x2) element-wise. Unlike `numpy.greater`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : array_like of str or unicode Input arrays of the same shape. Returns ------- out : ndarray Output array of bools. See Also -------- equal, not_equal, greater_equal, less_equal, less Examples -------- >>> x1 = np.array(['a', 'b', 'c']) >>> np.char.greater(x1, 'b') array([False, False, True]) >Tr rI rH rH rK r s r c C s t | |ddS )a Return (x1 < x2) element-wise. Unlike `numpy.greater`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : array_like of str or unicode Input arrays of the same shape. Returns ------- out : ndarray Output array of bools. See Also -------- equal, not_equal, greater_equal, less_equal, greater Examples -------- >>> x1 = np.array(['a', 'b', 'c']) >>> np.char.less(x1, 'b') array([True, False, False])