§ <ˆj‘ãóÔ —dZddlZddlmZddlmZmZmZmZm Z m Z m Z ddl m Z mZddl mZdd lmZdd lmZdd lmZddlZgd ¢Zdaejejd ¬¦«Zd„Zd`d„Zd„Zd„Zd„Z ee ¦«d„¦«Z!ee ¦«d„¦«Z"ee ¦«d„¦«Z#ee ¦«d„¦«Z$ee ¦«d„¦«Z%ee ¦«d„¦«Z&d„Z'ee'¦«d„¦«Z(ee ¦«d„¦«Z)d„Z*ee*¦«d„¦«Z+d„Z,ee,¦«d „¦«Z-ee'¦«d!„¦«Z.d`d"„Z/ee/¦«dad$„¦«Z0dbd%„Z1ee1¦«dcd&„¦«Z2dbd'„Z3ee3¦«dbd(„¦«Z4ee3¦«dbd)„¦«Z5dbd*„Z6ee6¦«dcd+„¦«Z7d`d,„Z8ee8¦«ddd.„¦«Z9ee1¦«dcd/„¦«Z:ee1¦«dcd0„¦«Z;ee'¦«d1„¦«Z<ee'¦«d2„¦«Z=ee'¦«d3„¦«Z>ee'¦«d4„¦«Z?ee'¦«d5„¦«Z@ee'¦«d6„¦«ZAee'¦«d7„¦«ZBd8„ZCeeC¦«d9„¦«ZDd`d:„ZEeeE¦«dad;„¦«ZFee'¦«d<„¦«ZGd`d=„ZHeeH¦«d`d>„¦«ZId?„ZJeeJ¦«d@„¦«ZKd`dA„ZLeeL¦«d`dB„¦«ZMee1¦«dcdC„¦«ZNee1¦«dcdD„¦«ZOeeE¦«dadE„¦«ZPeeJ¦«dF„¦«ZQdbdG„ZReeR¦«dbdH„¦«ZSd`dI„ZHeeH¦«d`dJ„¦«ZTeeR¦«dbdK„¦«ZUd`dL„ZVeeV¦«d`dM„¦«ZWdbdN„ZXeeX¦«dcdO„¦«ZYeeH¦«d`dP„¦«ZZee'¦«dQ„¦«Z[ee'¦«dR„¦«Z\d`dS„Z]ee]¦«d`dT„¦«Z^ee'¦«dU„¦«Z_dV„Z`ee`¦«dW„¦«Zaee'¦«dX„¦«Zbee'¦«dY„¦«ZcedZ¦«Gd[„d\e ¦«¦«Zded ¦«ded^„¦«Zed ¦«dfd_„¦«ZedS)gan 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_ÚintegerÚint_Úobject_Úbool_Ú character)ÚndarrayÚcompare_chararrays©Úarray)Ú _vec_string)Ú overrides)Úasbytes)3ÚequalÚ not_equalÚ greater_equalÚ less_equalÚgreaterÚlessÚstr_lenÚaddÚmultiplyÚmodÚ capitalizeÚcenterÚcountÚdecodeÚencodeÚendswithÚ expandtabsÚfindÚindexÚisalnumÚisalphaÚisdigitÚislowerÚisspaceÚistitleÚisupperÚjoinÚljustÚlowerÚlstripÚ partitionÚreplaceÚrfindÚrindexÚrjustÚ rpartitionÚrsplitÚrstripÚsplitÚ splitlinesÚ startswithÚstripÚswapcaseÚtitleÚ translateÚupperÚzfillÚ isnumericÚ isdecimalrÚasarrayz numpy.char)Úmodulecó–—t|t¦«s1ttj|¦«jjt¦«rdSdS)zƒReturns True if arr is a string or a string array with a dtype that represents a unicode string, otherwise returns False. TF)Ú isinstanceÚstrÚ issubclassÚnumpyrEÚdtypeÚtype)Úarrs úN/opt/cloudlinux/venv/lib64/python3.11/site-packages/numpy/core/defchararray.pyÚ _is_unicoderP1sB€õ �3�ÑÔðÝ •u”} SÑ)Ô)Ô/Ô4µcÑ :Ô :ðàˆtØ ˆ5ócóì—tj| ¦«¦«}t|dd¦«}|�:| t |¦«t |¦«¦«d¬¦«S|S)z” Helper function to cast a result back into an array with the appropriate dtype if an object array must be used as an intermediary. rLNF)Úcopy)rKrEÚtolistÚgetattrÚastyperMÚ_get_num_chars)ÚresultÚoutput_dtype_likeÚretrLs rOÚ_to_bytes_or_str_arrayr[<sf€õ Œ-˜Ÿ š ™œÑ (Ô (€CÝ Ð% w°Ñ 5Ô 5€EØ ÐØ�zŠz˜+�$˜u™+œ+¥n°SÑ&9Ô&9Ñ:Ô:ÀˆzÑGÔGÐGØ €JrQcóF—g}|D]}|€n| |¦«Œ|S)a! Helper function for delegating arguments to Python string functions. Many of the Python string operations that have optional arguments do not use 'None' to indicate a default value. In these cases, we need to remove all None arguments, and those following them. )Úappend)ÚargsÚnewargsÚchks rOÚ _clean_argsraIs<€ð€GØððˆØ ˆ;Ø ˆEØ�Š�sÑÔÐÐØ €NrQcób—t|jjt¦«r |jdzS|jS)zÀ Helper function that returns the number of characters per field in a string or unicode array. This is to abstract out the fact that for a unicode array this is itemsize / 4. é)rJrLrMrÚitemsize©Úas rOrWrWYs.€õ �!”'”,¥Ñ%Ô%ðØŒz˜Q‰ÐØ Œ:ÐrQcó —||fS©N©©Úx1Úx2s rOÚ_binary_op_dispatcherrmds €Ø �ˆ8€OrQcó&—t||dd¦«S)a 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. See Also -------- not_equal, greater_equal, less_equal, greater, less z==T©rrjs rOrrhó€õ. ˜b " d¨DÑ 1Ô 1Ð1rQcó&—t||dd¦«S)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 z!=Trorjs rOrr‚rprQcó&—t||dd¦«S)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 z>=Trorjs rOrrœs€õ0 ˜b " d¨DÑ 1Ô 1Ð1rQcó&—t||dd¦«S)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 z<=Trorjs rOrr·rprQcó&—t||dd¦«S)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 ú>Trorjs rOrrÑó€õ. ˜b " c¨4Ñ 0Ô 0Ð0rQcó&—t||dd¦«S)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 ú>> a = np.array(['Grace Hopper Conference', 'Open Source Day']) >>> np.char.str_len(a) array([23, 15]) >>> a = np.array([u'Р', u'о']) >>> np.char.str_len(a) array([1, 1]) >>> a = np.array([['hello', 'world'], [u'Р', u'о']]) >>> np.char.str_len(a) array([[5, 5], [1, 1]]) Ú__len__)rr res rOrr s€õB �q�$  Ñ *Ô *Ð*rQcó€—tj|¦«}tj|¦«}t|¦«t|¦«z}t|j¦«t|j¦«kr t d|j›d|j›d�¦«‚t |t|j¦«|¦«d|f¦«S)aº Return element-wise string concatenation for two arrays of str or unicode. Arrays `x1` and `x2` must have the same shape. Parameters ---------- x1 : array_like of str or unicode Input array. x2 : array_like of str or unicode Input array. Returns ------- add : ndarray Output array of `bytes_` or `str_`, depending on input types of the same shape as `x1` and `x2`. zLnp.char.add() requires both arrays of the same dtype kind, but got dtypes: 'z' and 'zJ' (the few cases where this used to work often lead to incorrect results).Ú__add__)rKrErWrMrLÚ TypeErrorr)rkrlÚarr1Úarr2Úout_sizes rOrr-sÍ€õ* Œ=˜Ñ Ô €DÝ Œ=˜Ñ Ô €DݘdÑ#Ô#¥n°TÑ&:Ô&:Ñ:€Hå ˆDŒJÑÔ�4 ¤ Ñ+Ô+Ò+Ð+õ ð HØ œJð Hð HØ/3¬zð Hð Hð HñIôIð Iõ �tÐ-�T $¤*Ñ-Ô-¨hÑ7Ô7¸ÀTÀGÑ LÔ LÐLrQcó—|fSrhri)rfÚis rOÚ_multiply_dispatcherr†Sr{rQcóˆ—tj|¦«}tj|¦«}t|jjt ¦«st d¦«‚t|¦«tt| ¦«¦«d¦«z}t|t |j¦«|¦«d|f¦«S)aê Return (a * i), that is string multiple concatenation, element-wise. Values in `i` of less than 0 are treated as 0 (which yields an empty string). Parameters ---------- a : array_like of str or unicode i : array_like of ints Returns ------- out : ndarray Output array of str or unicode, depending on input types Examples -------- >>> a = np.array(["a", "b", "c"]) >>> np.char.multiply(x, 3) array(['aaa', 'bbb', 'ccc'], dtype='>> i = np.array([1, 2, 3]) >>> np.char.multiply(a, i) array(['a', 'bb', 'ccc'], dtype='>> np.char.multiply(np.array(['a']), i) array(['a', 'aa', 'aaa'], dtype='>> a = np.array(['a', 'b', 'c', 'd', 'e', 'f']).reshape((2, 3)) >>> np.char.multiply(a, 3) array([['aaa', 'bbb', 'ccc'], ['ddd', 'eee', 'fff']], dtype='>> np.char.multiply(a, i) array([['a', 'bb', 'ccc'], ['d', 'ee', 'fff']], dtype='>> c = np.array(['a1b2','1b2a','b2a1','2a1b'],'S4'); c array(['a1b2', '1b2a', 'b2a1', '2a1b'], dtype='|S4') >>> np.char.capitalize(c) array(['A1b2', '1b2a', 'B2a1', '2a1b'], dtype='|S4') r©rKrErrL©rfrŒs rOrr¦s(€õF ŒM˜!Ñ Ô €EÝ �u˜eœk¨<Ñ 8Ô 8Ð8rQcó—|fSrhri©rfÚwidthÚfillchars rOÚ_center_dispatcherrœÍr{rQú cób—tj|¦«}tj|¦«}ttj|j¦«¦«}tj|jtj¦«rt|¦«}t|t|j¦«|¦«d||f¦«S)a\ Return a copy of `a` with its elements centered in a string of length `width`. Calls `str.center` element-wise. Parameters ---------- a : array_like of str or unicode width : int The length of the resulting strings fillchar : str or unicode, optional The padding character to use (default is space). Returns ------- out : ndarray Output array of str or unicode, depending on input types See Also -------- str.center Notes ----- This function is intended to work with arrays of strings. The fill character is not applied to numeric types. Examples -------- >>> c = np.array(['a1b2','1b2a','b2a1','2a1b']); c array(['a1b2', '1b2a', 'b2a1', '2a1b'], dtype='>> np.char.center(c, width=9) array([' a1b2 ', ' 1b2a ', ' b2a1 ', ' 2a1b '], dtype='>> np.char.center(c, width=9, fillchar='*') array(['***a1b2**', '***1b2a**', '***b2a1**', '***2a1b**'], dtype='>> np.char.center(c, width=1) array(['a', '1', 'b', '2'], dtype='>> c = np.array(['aAaAaA', ' aA ', 'abBABba']) >>> c array(['aAaAaA', ' aA ', 'abBABba'], dtype='>> np.char.count(c, 'A') array([3, 1, 1]) >>> np.char.count(c, 'aA') array([3, 1, 0]) >>> np.char.count(c, 'A', start=1, end=4) array([2, 1, 1]) >>> np.char.count(c, 'A', start=1, end=3) array([1, 0, 0]) r ©rr rar¦s rOr r s*€õV �q�$ ¨#¨u¨½ ÀCÑ8HÔ8HÑ)HÑ IÔ IÐIrQcó—|fSrhri©rfÚencodingÚerrorss rOÚ_code_dispatcherr±8r{rQc óf—tt|tdt||¦«¦«¦«S)aÒ Calls ``bytes.decode`` element-wise. The set of available codecs comes from the Python standard library, and may be extended at runtime. For more information, see the :mod:`codecs` module. Parameters ---------- a : array_like of str or unicode encoding : str, optional The name of an encoding errors : str, optional Specifies how to handle encoding errors Returns ------- out : ndarray See Also -------- :py:meth:`bytes.decode` Notes ----- The type of the result will depend on the encoding specified. Examples -------- >>> c = np.array([b'\x81\xc1\x81\xc1\x81\xc1', b'@@\x81\xc1@@', ... b'\x81\x82\xc2\xc1\xc2\x82\x81']) >>> c array([b'\x81\xc1\x81\xc1\x81\xc1', b'@@\x81\xc1@@', ... b'\x81\x82\xc2\xc1\xc2\x82\x81'], dtype='|S7') >>> np.char.decode(c, encoding='cp037') array(['aAaAaA', ' aA ', 'abBABba'], dtype='>> s = np.array(['foo', 'bar']) >>> s[0] = 'foo' >>> s[1] = 'bar' >>> s array(['foo', 'bar'], dtype='>> np.char.endswith(s, 'ar') array([False, True]) >>> np.char.endswith(s, 'a', start=1, end=2) array([False, True]) r#©rr rar¶s rOr#r#’s4€õP Ø �5�*˜v u˜oµ ¸CÑ0@Ô0@Ñ@ñ Bô BðBrQcó—|fSrhri©rfÚtabsizes rOÚ_expandtabs_dispatcherr¾¾r{rQécóN—tt|td|f¦«|¦«S)aS Return a copy of each string element where all tab characters are replaced by one or more spaces. Calls `str.expandtabs` element-wise. Return a copy of each string element where all tab characters are replaced by one or more spaces, depending on the current column and the given `tabsize`. The column number is reset to zero after each newline occurring in the string. This doesn't understand other non-printing characters or escape sequences. Parameters ---------- a : array_like of str or unicode Input array tabsize : int, optional Replace tabs with `tabsize` number of spaces. If not given defaults to 8 spaces. Returns ------- out : ndarray Output array of str or unicode, depending on input type See Also -------- str.expandtabs r$r”r¼s rOr$r$Âs,€õ@ "Ý�A•w  ¨w¨jÑ9Ô9¸1ñ >ô >ð>rQc óT—t|td||gt|¦«z¦«S)a3 For each element, return the lowest index in the string where substring `sub` is found. Calls `str.find` element-wise. For each element, return the lowest index in the string where substring `sub` is found, such that `sub` is contained in the range [`start`, `end`]. Parameters ---------- a : array_like of str or unicode sub : str or unicode start, end : int, optional Optional arguments `start` and `end` are interpreted as in slice notation. Returns ------- out : ndarray or int Output array of ints. Returns -1 if `sub` is not found. See Also -------- str.find Examples -------- >>> a = np.array(["NumPy is a Python library"]) >>> np.char.find(a, "Python", start=0, end=None) array([11]) r%r¬r¦s rOr%r%æs1€õL Ø �4�˜#˜u˜­ °CÑ(8Ô(8Ñ8ñ :ô :ð:rQc óT—t|td||gt|¦«z¦«S)a Like `find`, but raises `ValueError` when the substring is not found. Calls `str.index` element-wise. Parameters ---------- a : array_like of str or unicode sub : str or unicode start, end : int, optional Returns ------- out : ndarray Output array of ints. Returns -1 if `sub` is not found. See Also -------- find, str.find Examples -------- >>> a = np.array(["Computer Science"]) >>> np.char.index(a, "Science", start=0, end=None) array([9]) r&r¬r¦s rOr&r&s0€õ> Ø �4�˜3 ˜,­°SÑ)9Ô)9Ñ9ñ ;ô ;ð;rQcó.—t|td¦«S)aÌ Returns true for each element if all characters in the string are alphanumeric and there is at least one character, false otherwise. Calls `str.isalnum` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode Returns ------- out : ndarray Output array of str or unicode, depending on input type See Also -------- str.isalnum r'©rr res rOr'r'3ó€õ. �q�% Ñ +Ô +Ð+rQcó.—t|td¦«S)a¨ Returns true for each element if all characters in the string are alphabetic and there is at least one character, false otherwise. Calls `str.isalpha` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode Returns ------- out : ndarray Output array of bools See Also -------- str.isalpha r(rÄres rOr(r(MrÅrQcó.—t|td¦«S)a¯ Returns true for each element if all characters in the string are digits and there is at least one character, false otherwise. Calls `str.isdigit` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode Returns ------- out : ndarray Output array of bools See Also -------- str.isdigit Examples -------- >>> a = np.array(['a', 'b', '0']) >>> np.char.isdigit(a) array([False, False, True]) >>> a = np.array([['a', 'b', '0'], ['c', '1', '2']]) >>> np.char.isdigit(a) array([[False, False, True], [False, True, True]]) r)rÄres rOr)r)gs€õ@ �q�% Ñ +Ô +Ð+rQcó.—t|td¦«S)a· Returns true for each element if all cased characters in the string are lowercase and there is at least one cased character, false otherwise. Calls `str.islower` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode Returns ------- out : ndarray Output array of bools See Also -------- str.islower r*rÄres rOr*r*Šó€õ0 �q�% Ñ +Ô +Ð+rQcó.—t|td¦«S)a³ Returns true for each element if there are only whitespace characters in the string and there is at least one character, false otherwise. Calls `str.isspace` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode Returns ------- out : ndarray Output array of bools See Also -------- str.isspace r+rÄres rOr+r+¥rÉrQcó.—t|td¦«S)až Returns true for each element if the element is a titlecased string and there is at least one character, false otherwise. Call `str.istitle` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode Returns ------- out : ndarray Output array of bools See Also -------- str.istitle r,rÄres rOr,r,ÀrÅrQcó.—t|td¦«S)a€ Return true for each element if all cased characters in the string are uppercase and there is at least one character, false otherwise. Call `str.isupper` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode Returns ------- out : ndarray Output array of bools See Also -------- str.isupper Examples -------- >>> str = "GHC" >>> np.char.isupper(str) array(True) >>> a = np.array(["hello", "HELLO", "Hello"]) >>> np.char.isupper(a) array([False, True, False]) r-rÄres rOr-r-Ús€õD �q�% Ñ +Ô +Ð+rQcó —||fSrhri©ÚsepÚseqs rOÚ_join_dispatcherrÑÿs €Ø �ˆ:ÐrQcóN—tt|td|f¦«|¦«S)a= Return a string which is the concatenation of the strings in the sequence `seq`. Calls `str.join` element-wise. Parameters ---------- sep : array_like of str or unicode seq : array_like of str or unicode Returns ------- out : ndarray Output array of str or unicode, depending on input types See Also -------- str.join Examples -------- >>> np.char.join('-', 'osd') array('o-s-d', dtype='>> np.char.join(['-', '.'], ['ghc', 'osd']) array(['g-h-c', 'o.s.d'], dtype=' "Ý�C� &¨3¨&Ñ1Ô1°3ñ 8ô 8ð8rQcó—|fSrhrir™s rOÚ_just_dispatcherrÔ'r{rQcób—tj|¦«}tj|¦«}ttj|j¦«¦«}tj|jtj¦«rt|¦«}t|t|j¦«|¦«d||f¦«S)að Return an array with the elements of `a` left-justified in a string of length `width`. Calls `str.ljust` element-wise. Parameters ---------- a : array_like of str or unicode width : int The length of the resulting strings fillchar : str or unicode, optional The character to use for padding Returns ------- out : ndarray Output array of str or unicode, depending on input type See Also -------- str.ljust r/rŸr¢s rOr/r/+ó™€õ6 ŒM˜!Ñ Ô €EÝ” ˜eÑ$Ô$€IÝ �uŒy˜œÑ(Ô(Ñ )Ô )€DÝ Ô˜œ ¥U¤\Ñ2Ô2ð%ݘ8Ñ$Ô$ˆÝ Ø Ð �t�E”KÑ Ô  Ñ&Ô&¨°)¸XÐ1Fñ Hô HðHrQcóV—tj|¦«}t||jd¦«S)ag Return an array with the elements converted to lowercase. Call `str.lower` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like, {str, unicode} Input array. Returns ------- out : ndarray, {str, unicode} Output array of str or unicode, depending on input type See Also -------- str.lower Examples -------- >>> c = np.array(['A1B C', '1BCA', 'BCA1']); c array(['A1B C', '1BCA', 'BCA1'], dtype='>> np.char.lower(c) array(['a1b c', '1bca', 'bca1'], dtype=' ŒM˜!Ñ Ô €EÝ �u˜eœk¨7Ñ 3Ô 3Ð3rQcó—|fSrhri©rfÚcharss rOÚ_strip_dispatcherrÜrr{rQcóZ—tj|¦«}t||jd|f¦«S)am For each element in `a`, return a copy with the leading characters removed. Calls `str.lstrip` element-wise. Parameters ---------- a : array-like, {str, unicode} Input array. chars : {str, unicode}, optional The `chars` argument is a string specifying the set of characters to be removed. If omitted or None, the `chars` argument defaults to removing whitespace. The `chars` argument is not a prefix; rather, all combinations of its values are stripped. Returns ------- out : ndarray, {str, unicode} Output array of str or unicode, depending on input type See Also -------- str.lstrip Examples -------- >>> c = np.array(['aAaAaA', ' aA ', 'abBABba']) >>> c array(['aAaAaA', ' aA ', 'abBABba'], dtype='>> np.char.lstrip(c, 'a') array(['AaAaA', ' aA ', 'bBABba'], dtype='>> np.char.lstrip(c, 'A') # leaves c unchanged array(['aAaAaA', ' aA ', 'abBABba'], dtype='>> (np.char.lstrip(c, ' ') == np.char.lstrip(c, '')).all() ... # XXX: is this a regression? This used to return True ... # np.char.lstrip(c,'') does not modify c at all. False >>> (np.char.lstrip(c, ' ') == np.char.lstrip(c, None)).all() True r1r–©rfrÛrŒs rOr1r1vs,€õf ŒM˜!Ñ Ô €EÝ �u˜eœk¨8°e°XÑ >Ô >Ð>rQcó—|fSrhri©rfrÏs rOÚ_partition_dispatcherrá­r{rQcóN—tt|td|f¦«|¦«S)aU Partition each element in `a` around `sep`. Calls `str.partition` element-wise. For each element in `a`, split the element as the first occurrence of `sep`, and return 3 strings containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return 3 strings containing the string itself, followed by two empty strings. Parameters ---------- a : array_like, {str, unicode} Input array sep : {str, unicode} Separator to split each string element in `a`. Returns ------- out : ndarray, {str, unicode} Output array of str or unicode, depending on input type. The output array will have an extra dimension with 3 elements per input element. See Also -------- str.partition r2r”ràs rOr2r2±s,€õ@ "Ý�A•w  ¨c¨VÑ4Ô4°añ 9ô 9ð9rQcó—|fSrhri©rfÚoldÚnewr s rOÚ_replace_dispatcherrçÕr{rQc óp—tt|td||gt|¦«z¦«|¦«S)aš For each element in `a`, return a copy of the string with all occurrences of substring `old` replaced by `new`. Calls `str.replace` element-wise. Parameters ---------- a : array-like of str or unicode old, new : str or unicode count : int, optional If the optional argument `count` is given, only the first `count` occurrences are replaced. Returns ------- out : ndarray Output array of str or unicode, depending on input type See Also -------- str.replace Examples -------- >>> a = np.array(["That is a mango", "Monkeys eat mangos"]) >>> np.char.replace(a, 'mango', 'banana') array(['That is a banana', 'Monkeys eat bananas'], dtype='>> a = np.array(["The dish is fresh", "This is it"]) >>> np.char.replace(a, 'is', 'was') array(['The dwash was fresh', 'Thwas was it'], dtype='€õJ "Ý�A•w  ¨C°¨:½ ÀEÑ8JÔ8JÑ+JÑKÔKÈQñ Pô PðPrQc óT—t|td||gt|¦«z¦«S)a. For each element in `a`, return the highest index in the string where substring `sub` is found, such that `sub` is contained within [`start`, `end`]. Calls `str.rfind` element-wise. Parameters ---------- a : array-like of str or unicode sub : str or unicode start, end : int, optional Optional arguments `start` and `end` are interpreted as in slice notation. Returns ------- out : ndarray Output array of ints. Return -1 on failure. See Also -------- str.rfind r4r¬r¦s rOr4r4s0€õ: Ø �4�˜3 ˜,­°SÑ)9Ô)9Ñ9ñ ;ô ;ð;rQc óT—t|td||gt|¦«z¦«S)ax Like `rfind`, but raises `ValueError` when the substring `sub` is not found. Calls `str.rindex` element-wise. Parameters ---------- a : array-like of str or unicode sub : str or unicode start, end : int, optional Returns ------- out : ndarray Output array of ints. See Also -------- rfind, str.rindex r5r¬r¦s rOr5r5#s0€õ4 Ø �4�˜C ˜<­+°cÑ*:Ô*:Ñ:ñ <ô <ð>> c = np.array(['aAaAaA', 'abBABba'], dtype='S7'); c array(['aAaAaA', 'abBABba'], dtype='|S7') >>> np.char.rstrip(c, b'a') array(['aAaAaA', 'abBABb'], dtype='|S7') >>> np.char.rstrip(c, b'A') array(['aAaAa', 'abBABba'], dtype='|S7') r9r–rÞs rOr9r9·s,€õR ŒM˜!Ñ Ô €EÝ �u˜eœk¨8°e°XÑ >Ô >Ð>rQc óR—t|td|gt|¦«z¦«S)a6 For each element in `a`, return a list of the words in the string, using `sep` as the delimiter string. Calls `str.split` element-wise. Parameters ---------- a : array_like of str or unicode sep : str or unicode, optional If `sep` is not specified or None, any whitespace string is a separator. maxsplit : int, optional If `maxsplit` is given, at most `maxsplit` splits are done. Returns ------- out : ndarray Array of list objects See Also -------- str.split, rsplit r:ròrîs rOr:r:äs.€õ> Ø �7�G˜c˜U¥[°Ñ%:Ô%:Ñ:ñ <ô <ð>> c = np.array(['aAaAaA', ' aA ', 'abBABba']) >>> c array(['aAaAaA', ' aA ', 'abBABba'], dtype='>> np.char.strip(c) array(['aAaAaA', 'aA', 'abBABba'], dtype='>> np.char.strip(c, 'a') # 'a' unstripped from c[1] because whitespace leads array(['AaAaA', ' aA ', 'bBABb'], dtype='>> np.char.strip(c, 'A') # 'A' unstripped from c[1] because (unprinted) ws trails array(['aAaAa', ' aA ', 'abBABba'], dtype='>> c=np.array(['a1B c','1b Ca','b Ca1','cA1b'],'S5'); c array(['a1B c', '1b Ca', 'b Ca1', 'cA1b'], dtype='|S5') >>> np.char.swapcase(c) array(['A1b C', '1B cA', 'B cA1', 'Ca1B'], dtype='|S5') r>r–r—s rOr>r>zs(€õD ŒM˜!Ñ Ô €EÝ �u˜eœk¨:Ñ 6Ô 6Ð6rQcóV—tj|¦«}t||jd¦«S)aó Return element-wise title cased version of string or unicode. Title case words start with uppercase characters, all remaining cased characters are lowercase. Calls `str.title` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like, {str, unicode} Input array. Returns ------- out : ndarray Output array of str or unicode, depending on input type See Also -------- str.title Examples -------- >>> c=np.array(['a1b c','1b ca','b ca1','ca1b'],'S5'); c array(['a1b c', '1b ca', 'b ca1', 'ca1b'], dtype='|S5') >>> np.char.title(c) array(['A1B C', '1B Ca', 'B Ca1', 'Ca1B'], dtype='|S5') r?r–r—s rOr?r? s(€õH ŒM˜!Ñ Ô €EÝ �u˜eœk¨7Ñ 3Ô 3Ð3rQcó—|fSrhri)rfÚtableÚ deletecharss rOÚ_translate_dispatcherrÈr{rQc óè—tj|¦«}t|jjt ¦«rt ||jd|f¦«St ||jd|gt|¦«z¦«S)a, For each element in `a`, return a copy of the string where all characters occurring in the optional argument `deletechars` are removed, and the remaining characters have been mapped through the given translation table. Calls `str.translate` element-wise. Parameters ---------- a : array-like of str or unicode table : str of length 256 deletechars : str Returns ------- out : ndarray Output array of str or unicode, depending on input type See Also -------- str.translate r@)rKrErJrLrMrrra)rfrrrŒs rOr@r@Ìs{€õ8 ŒM˜!Ñ Ô €EÝ�%”+Ô"¥DÑ)Ô)ðQÝØ �5”;  ¨e¨Xñ7ô7ð 7õØ �5”;  ¨e¨Wµ{À;Ñ7OÔ7OÑ-OñQôQð QrQcóV—tj|¦«}t||jd¦«S)ah Return an array with the elements converted to uppercase. Calls `str.upper` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like, {str, unicode} Input array. Returns ------- out : ndarray, {str, unicode} Output array of str or unicode, depending on input type See Also -------- str.upper Examples -------- >>> c = np.array(['a1b c', '1bca', 'bca1']); c array(['a1b c', '1bca', 'bca1'], dtype='>> np.char.upper(c) array(['A1B C', '1BCA', 'BCA1'], dtype='>> np.char.isnumeric(['123', '123abc', '9.0', '1/4', 'VIII']) array([ True, False, False, False, False]) z:isnumeric is only available for Unicode strings and arraysrC©rPr€rr res rOrCrC7s5€õ@ �q‰>Œ>ðVÝÐTÑUÔUÐUÝ �q�% Ñ -Ô -Ð-rQcój—t|¦«std¦«‚t|td¦«S)a’ For each element, return True if there are only decimal characters in the element. Calls `str.isdecimal` element-wise. Decimal characters include digit characters, and all characters that can be used to form decimal-radix numbers, e.g. ``U+0660, ARABIC-INDIC DIGIT ZERO``. Parameters ---------- a : array_like, unicode Input array. Returns ------- out : ndarray, bool Array of booleans identical in shape to `a`. See Also -------- str.isdecimal Examples -------- >>> np.char.isdecimal(['12345', '4.99', '123ABC', '']) array([ True, False, False, False]) z:isdecimal is only available for Unicode strings and arraysrDr res rOrDrD\s>€õ@ �q‰>Œ>ðJÝØ HñJôJð Jå �q�% Ñ -Ô -Ð-rQrKcó°—eZdZdZ dAd„Zd„Zd „Zd „Zd „Zd „Z d „Z d„Z d„Z d„Z d„Zd„Zd„Zd„Zd„ZdBd„Zejje_d„ZdCd„ZdDd„ZdEd„ZdEd„ZdDd„ZdFd „ZdDd!„ZdDd"„Zd#„Zd$„Zd%„Z d&„Z!d'„Z"d(„Z#d)„Z$d*„Z%dCd+„Z&d,„Z'dGd-„Z(d.„Z)dGd/„Z*dDd0„Z+dDd1„Z,dCd2„Z-d3„Z.dEd4„Z/dGd5„Z0dEd6„Z1dGd7„Z2dDd8„Z3dGd9„Z4d:„Z5d;„Z6dGd<„Z7d=„Z8d>„Z9d?„Z:d@„Z;dS)HÚ chararraya chararray(shape, itemsize=1, unicode=False, buffer=None, offset=0, strides=None, order=None) Provides a convenient view on arrays of string and unicode values. .. 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. Versus a regular NumPy array of type `str` or `unicode`, this class adds the following functionality: 1) values automatically have whitespace removed from the end when indexed 2) comparison operators automatically remove whitespace from the end when comparing values 3) vectorized string operations are provided as methods (e.g. `.endswith`) and infix operators (e.g. ``"+", "*", "%"``) chararrays should be created using `numpy.char.array` or `numpy.char.asarray`, rather than this constructor directly. This constructor creates the array, using `buffer` (with `offset` and `strides`) if it is not ``None``. If `buffer` is ``None``, then constructs a new array with `strides` in "C order", unless both ``len(shape) >= 2`` and ``order='F'``, in which case `strides` is in "Fortran order". Methods ------- astype argsort copy count decode dump dumps encode endswith expandtabs fill find flatten getfield index isalnum isalpha isdecimal isdigit islower isnumeric isspace istitle isupper item join ljust lower lstrip nonzero put ravel repeat replace reshape resize rfind rindex rjust rsplit rstrip searchsorted setfield setflags sort split splitlines squeeze startswith strip swapaxes swapcase take title tofile tolist tostring translate transpose upper view zfill Parameters ---------- shape : tuple Shape of the array. itemsize : int, optional Length of each array element, in number of characters. Default is 1. unicode : bool, optional Are the array elements of type unicode (True) or string (False). Default is False. buffer : object exposing the buffer interface or str, optional Memory address of the start of the array data. Default is None, in which case a new array is created. offset : int, optional Fixed stride displacement from the beginning of an axis? Default is 0. Needs to be >=0. strides : array_like of ints, optional Strides for the array (see `ndarray.strides` for full description). Default is None. order : {'C', 'F'}, optional The order in which the array data is stored in memory: 'C' -> "row major" order (the default), 'F' -> "column major" (Fortran) order. Examples -------- >>> charar = np.chararray((3, 3)) >>> charar[:] = 'a' >>> charar chararray([[b'a', b'a', b'a'], [b'a', b'a', b'a'], [b'a', b'a', b'a']], dtype='|S1') >>> charar = np.chararray(charar.shape, itemsize=5) >>> charar[:] = 'abc' >>> charar chararray([[b'abc', b'abc', b'abc'], [b'abc', b'abc', b'abc'], [b'abc', b'abc', b'abc']], dtype='|S5') rFNrÚCc ó—|rt}nt}t|¦«}t|t¦«r|} d}nd} da|€t j||||f|¬¦«} nt j||||f||||¬¦«} | �| | d<da| S)Nr©Úorder)ÚbufferÚoffsetÚstridesr.r)rrr‹rHrIÚ _globalvarr Ú__new__) ÚsubtypeÚshaperdÚunicoderrrrrLÚfillerÚselfs rOrzchararray.__new__sÁ€ð ð ݈EˆEåˆEõ �x‘=”=ˆå �f�cÑ "Ô "ð àˆF؈FˆFàˆFàˆ Ø ˆ>Ý”? 7¨E°E¸8Ð3DØ).ð0ñ0ô0ˆDˆDõ”? 7¨E°E¸8Ð3DØ*0Ø*0¸'Ø).ð0ñ0ô0ˆDð Р؈D�‰I؈ ؈ rQcóR—ts|jjdvrtd¦«‚dSdS)NÚSUbcz-Can only create a chararray from string data.)rrLÚcharr‰)rÚobjs rOÚ__array_finalize__zchararray.__array_finalize__2s:€åð N˜dœjœo°VÐ;Ð;ÝÐLÑMÔMÐ Mð Nð NÐ;Ð;rQcó²—tj||¦«}t|t¦«r,| ¦«}t |¦«dkrd}n|}|S)NrÚ)r Ú __getitem__rHr r9Úlen)rr"ÚvalÚtemps rOr&zchararray.__getitem__7sS€ÝÔ! $¨Ñ,Ô,ˆå �c�9Ñ %Ô %ð Ø—:’:‘<”<ˆDÝ�4‰yŒy˜AŠ~ˆ~Ø��à�àˆ rQcó"—t||¦«S)zg Return (self == other) element-wise. See Also -------- equal )r©rÚothers rOÚ__eq__zchararray.__eq__Hs€õ�T˜5Ñ!Ô!Ð!rQcó"—t||¦«S)zk Return (self != other) element-wise. See Also -------- not_equal )rr+s rOÚ__ne__zchararray.__ne__Rs€õ˜˜uÑ%Ô%Ð%rQcó"—t||¦«S)zo Return (self >= other) element-wise. See Also -------- greater_equal )rr+s rOÚ__ge__zchararray.__ge__\s€õ˜T 5Ñ)Ô)Ð)rQcó"—t||¦«S)zl Return (self <= other) element-wise. See Also -------- less_equal )rr+s rOÚ__le__zchararray.__le__fs€õ˜$ Ñ&Ô&Ð&rQcó"—t||¦«S)zh Return (self > other) element-wise. See Also -------- greater )rr+s rOÚ__gt__zchararray.__gt__ps€õ�t˜UÑ#Ô#Ð#rQcó"—t||¦«S)ze Return (self < other) element-wise. See Also -------- less )rr+s rOÚ__lt__zchararray.__lt__zs€õ�D˜%Ñ Ô Ð rQcó<—tt||¦«¦«S)z· Return (self + other), that is string concatenation, element-wise for a pair of array_likes of str or unicode. See Also -------- add )rErr+s rOrzchararray.__add__„s€õ•s˜4 Ñ'Ô'Ñ(Ô(Ð(rQcó`—tttj|¦«|¦«¦«S)z» Return (other + self), that is string concatenation, element-wise for a pair of array_likes of `bytes_` or `str_`. See Also -------- add )rErrKr+s rOÚ__radd__zchararray.__radd__�s&€õ•s�5œ=¨Ñ/Ô/°Ñ6Ô6Ñ7Ô7Ð7rQcó<—tt||¦«¦«S©z• Return (self * i), that is string multiple concatenation, element-wise. See Also -------- multiply ©rEr©rr…s rOrˆzchararray.__mul__šó€õ•x  aÑ(Ô(Ñ)Ô)Ð)rQcó<—tt||¦«¦«Sr<r=r>s rOÚ__rmul__zchararray.__rmul__¥r?rQcó<—tt||¦«¦«S)zÛ Return (self % i), that is pre-Python 2.6 string formatting (interpolation), element-wise for a pair of array_likes of `bytes_` or `str_`. See Also -------- mod )rErr>s rOr“zchararray.__mod__°s€õ•s˜4 ‘|”|Ñ$Ô$Ð$rQcó—tSrh)ÚNotImplementedr+s rOÚ__rmod__zchararray.__rmod__¼s€ÝÐrQéÿÿÿÿcóT—| ¦« |||¦«S)a Return the indices that sort the array lexicographically. For full documentation see `numpy.argsort`, for which this method is in fact merely a "thin wrapper." Examples -------- >>> c = np.array(['a1b c', '1b ca', 'b ca1', 'Ca1b'], 'S5') >>> c = c.view(np.chararray); c chararray(['a1b c', '1b ca', 'b ca1', 'Ca1b'], dtype='|S5') >>> c[c.argsort()] chararray(['1b ca', 'Ca1b', 'a1b c', 'b ca1'], dtype='|S5') )Ú __array__Úargsort)rÚaxisÚkindrs rOrIzchararray.argsort¿s&€ð$�~Š~ÑÔ×'Ò'¨¨d°EÑ:Ô:Ð:rQcó:—tt|¦«¦«S)z¨ Return a copy of `self` with only the first character of each element capitalized. See Also -------- char.capitalize )rEr©rs rOrzchararray.capitalizeÔs€õ•z $Ñ'Ô'Ñ(Ô(Ð(rQr�có>—tt|||¦«¦«S)z� Return a copy of `self` with its elements centered in a string of length `width`. See Also -------- center )rEr©rršr›s rOrzchararray.centeràs€õ•v˜d E¨8Ñ4Ô4Ñ5Ô5Ð5rQcó&—t||||¦«S)z Returns an array with the number of non-overlapping occurrences of substring `sub` in the range [`start`, `end`]. See Also -------- char.count )r ©rr§r¨r©s rOr zchararray.countës€õ�T˜3  sÑ+Ô+Ð+rQcó$—t|||¦«S)zn Calls ``bytes.decode`` element-wise. See Also -------- char.decode )r!©rr¯r°s rOr!zchararray.decode÷ó€õ�d˜H fÑ-Ô-Ð-rQcó$—t|||¦«S)zj Calls `str.encode` element-wise. See Also -------- char.encode )r"rSs rOr"zchararray.encode rTrQcó&—t||||¦«S)zÅ Returns a boolean array which is `True` where the string element in `self` ends with `suffix`, otherwise `False`. See Also -------- char.endswith )r#)rr·r¨r©s rOr#zchararray.endswith s€õ˜˜f e¨SÑ1Ô1Ð1rQr¿có<—tt||¦«¦«S)z· Return a copy of each string element where all tab characters are replaced by one or more spaces. See Also -------- char.expandtabs )rEr$)rr½s rOr$zchararray.expandtabs s€õ•z $¨Ñ0Ô0Ñ1Ô1Ð1rQcó&—t||||¦«S)z§ For each element, return the lowest index in the string where substring `sub` is found. See Also -------- char.find )r%rQs rOr%zchararray.find% s€õ�D˜#˜u cÑ*Ô*Ð*rQcó&—t||||¦«S)zŽ Like `find`, but raises `ValueError` when the substring is not found. See Also -------- char.index )r&rQs rOr&zchararray.index1 s€õ�T˜3  sÑ+Ô+Ð+rQcó —t|¦«S)zß Returns true for each element if all characters in the string are alphanumeric and there is at least one character, false otherwise. See Also -------- char.isalnum )r'rMs rOr'zchararray.isalnum< ó€õ�t‰}Œ}ÐrQcó —t|¦«S)zÝ Returns true for each element if all characters in the string are alphabetic and there is at least one character, false otherwise. See Also -------- char.isalpha )r(rMs rOr(zchararray.isalphaI r[rQcó —t|¦«S)zÑ Returns true for each element if all characters in the string are digits and there is at least one character, false otherwise. See Also -------- char.isdigit )r)rMs rOr)zchararray.isdigitV ó€õ�t‰}Œ}ÐrQcó —t|¦«S)zè Returns true for each element if all cased characters in the string are lowercase and there is at least one cased character, false otherwise. See Also -------- char.islower )r*rMs rOr*zchararray.islowerb r[rQcó —t|¦«S)zä Returns true for each element if there are only whitespace characters in the string and there is at least one character, false otherwise. See Also -------- char.isspace )r+rMs rOr+zchararray.isspaceo r[rQcó —t|¦«S)zÌ Returns true for each element if the element is a titlecased string and there is at least one character, false otherwise. See Also -------- char.istitle )r,rMs rOr,zchararray.istitle| r^rQcó —t|¦«S)zâ Returns true for each element if all cased characters in the string are uppercase and there is at least one character, false otherwise. See Also -------- char.isupper )r-rMs rOr-zchararray.isupperˆ r[rQcó"—t||¦«S)z  Return a string which is the concatenation of the strings in the sequence `seq`. See Also -------- char.join )r.)rrÐs rOr.zchararray.join• s€õ�D˜#‰ŒÐrQcó>—tt|||¦«¦«S)zª Return an array with the elements of `self` left-justified in a string of length `width`. See Also -------- char.ljust )rEr/rOs rOr/zchararray.ljust¡ ó€õ•u˜T 5¨(Ñ3Ô3Ñ4Ô4Ð4rQcó:—tt|¦«¦«S)z” Return an array with the elements of `self` converted to lowercase. See Also -------- char.lower )rEr0rMs rOr0zchararray.lower­ ó€õ•u˜T‘{”{Ñ#Ô#Ð#rQcó<—tt||¦«¦«S)z  For each element in `self`, return a copy with the leading characters removed. See Also -------- char.lstrip )rEr1©rrÛs rOr1zchararray.lstrip¹ ó€õ•v˜d EÑ*Ô*Ñ+Ô+Ð+rQcó<—tt||¦«¦«S)zu Partition each element in `self` around `sep`. See Also -------- partition )rEr2©rrÏs rOr2zchararray.partitionÅ s€õ•y  sÑ+Ô+Ñ,Ô,Ð,rQcó@—tt||||¦«¦«S)zÅ For each element in `self`, return a copy of the string with all occurrences of substring `old` replaced by `new`. See Also -------- char.replace )rEr3)rrårær s rOr3zchararray.replaceÏ s €õ•w˜t S¨#¨uÑ5Ô5Ñ6Ô6Ð6rQcó&—t||||¦«S)zñ For each element in `self`, return the highest index in the string where substring `sub` is found, such that `sub` is contained within [`start`, `end`]. See Also -------- char.rfind )r4rQs rOr4zchararray.rfindÛ s€õ�T˜3  sÑ+Ô+Ð+rQcó&—t||||¦«S)zž Like `rfind`, but raises `ValueError` when the substring `sub` is not found. See Also -------- char.rindex )r5rQs rOr5zchararray.rindexè s€õ�d˜C ¨Ñ,Ô,Ð,rQcó>—tt|||¦«¦«S)z« Return an array with the elements of `self` right-justified in a string of length `width`. See Also -------- char.rjust )rEr6rOs rOr6zchararray.rjustô rerQcó<—tt||¦«¦«S)zv Partition each element in `self` around `sep`. See Also -------- rpartition )rEr7rls rOr7zchararray.rpartition s€õ•z $¨Ñ,Ô,Ñ-Ô-Ð-rQcó$—t|||¦«S)z¼ For each element in `self`, return a list of the words in the string, using `sep` as the delimiter string. See Also -------- char.rsplit )r8©rrÏrïs rOr8zchararray.rsplit s€õ�d˜C Ñ*Ô*Ð*rQcó<—tt||¦«¦«S)z¡ For each element in `self`, return a copy with the trailing characters removed. See Also -------- char.rstrip )rEr9ris rOr9zchararray.rstrip rjrQcó$—t|||¦«S)z» For each element in `self`, return a list of the words in the string, using `sep` as the delimiter string. See Also -------- char.split )r:rss rOr:zchararray.split" s€õ�T˜3 Ñ)Ô)Ð)rQcó"—t||¦«S)z¹ For each element in `self`, return a list of the lines in the element, breaking at line boundaries. See Also -------- char.splitlines )r;)rrøs rOr;zchararray.splitlines. s€õ˜$ Ñ)Ô)Ð)rQcó&—t||||¦«S)zÉ Returns a boolean array which is `True` where the string element in `self` starts with `prefix`, otherwise `False`. See Also -------- char.startswith )r<)rrýr¨r©s rOr<zchararray.startswith: s€õ˜$ ¨¨sÑ3Ô3Ð3rQcó<—tt||¦«¦«S)z¬ For each element in `self`, return a copy with the leading and trailing characters removed. See Also -------- char.strip )rEr=ris rOr=zchararray.stripF ó€õ•u˜T 5Ñ)Ô)Ñ*Ô*Ð*rQcó:—tt|¦«¦«S)zÌ For each element in `self`, return a copy of the string with uppercase characters converted to lowercase and vice versa. See Also -------- char.swapcase )rEr>rMs rOr>zchararray.swapcaseR s€õ•x ‘~”~Ñ&Ô&Ð&rQcó:—tt|¦«¦«S)zô For each element in `self`, return a titlecased version of the string: words start with uppercase characters, all remaining cased characters are lowercase. See Also -------- char.title )rEr?rMs rOr?zchararray.title^ s€õ•u˜T‘{”{Ñ#Ô#Ð#rQcó>—tt|||¦«¦«S)aB For each element in `self`, return a copy of the string where all characters occurring in the optional argument `deletechars` are removed, and the remaining characters have been mapped through the given translation table. See Also -------- char.translate )rEr@)rrrs rOr@zchararray.translatek s€õ•y  u¨kÑ:Ô:Ñ;Ô;Ð;rQcó:—tt|¦«¦«S)z” Return an array with the elements of `self` converted to uppercase. See Also -------- char.upper )rErArMs rOrAzchararray.uppery rgrQcó<—tt||¦«¦«S)z  Return the numeric string left-filled with zeros in a string of length `width`. See Also -------- char.zfill )rErB)rršs rOrBzchararray.zfill… ryrQcó —t|¦«S)z± For each element in `self`, return True if there are only numeric characters in the element. See Also -------- char.isnumeric )rCrMs rOrCzchararray.isnumeric‘ ó€õ˜‰ŒÐrQcó —t|¦«S)z± For each element in `self`, return True if there are only decimal characters in the element. See Also -------- char.isdecimal )rDrMs rOrDzchararray.isdecimal� r€rQ)rFNrNr)rFNN©r�©rN©NN©r¿rh)<Ú__name__Ú __module__Ú __qualname__Ú__doc__rr#r&r-r/r1r3r5r7rr:rˆrAr“rErIr rrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrirQrOrr‚s退€€€ðJðJðVCGØ.1ð!ð!ð!ð!ðFNðNðNð ð ð ð""ð"ð"ð&ð&ð&ð*ð*ð*ð'ð'ð'ð$ð$ð$ð!ð!ð!ð )ð )ð )ð 8ð 8ð 8ð *ð *ð *ð *ð *ð *ð %ð %ð %ðððð;ð;ð;ð;ð&”oÔ-€G„Oð )ð )ð )ð 6ð 6ð 6ð 6ð ,ð ,ð ,ð ,ð .ð .ð .ð .ð .ð .ð .ð .ð 2ð 2ð 2ð 2ð 2ð 2ð 2ð 2ð +ð +ð +ð +ð ,ð ,ð ,ð ,ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð 5ð 5ð 5ð 5ð $ð $ð $ð ,ð ,ð ,ð ,ð-ð-ð-ð 7ð 7ð 7ð 7ð ,ð ,ð ,ð ,ð -ð -ð -ð -ð 5ð 5ð 5ð 5ð.ð.ð.ð +ð +ð +ð +ð ,ð ,ð ,ð ,ð *ð *ð *ð *ð *ð *ð *ð *ð 4ð 4ð 4ð 4ð +ð +ð +ð +ð 'ð 'ð 'ð $ð $ð $ð <ð <ð <ð <ð $ð $ð $ð +ð +ð +ð ð ð ð ð ð ð ð rQrTcó—t|ttf¦«rS|€t|t¦«rd}nd}|€t|¦«}t|¦«|z}t |||||¬¦«St|t t f¦«rtj|¦«}t|t¦«�r,t|j j t¦«�r t|t¦«s| t¦«}|€+|j}t|j j t ¦«r|dz}|€$t|j j t ¦«rd}nd}|rt }nt"}|�tj||¬¦«}|s9||jks.|st|t ¦«s|r9t|t"¦«r$| |t'|¦«f¦«}|St|t¦«r5t|j j t(¦«r|€| ¦«}|rt }nt"}|€t-|||d¬¦«}nt-|||f|d¬¦«}| t¦«S)a  Create a `chararray`. .. note:: This class is provided for numarray backward-compatibility. New code (not concerned with numarray compatibility) should use arrays of type `bytes_` or `str_` and use the free functions in :mod:`numpy.char ` for fast vectorized string operations instead. Versus a regular NumPy array of type `str` or `unicode`, this class adds the following functionality: 1) values automatically have whitespace removed from the end when indexed 2) comparison operators automatically remove whitespace from the end when comparing values 3) vectorized string operations are provided as methods (e.g. `str.endswith`) and infix operators (e.g. ``+, *, %``) Parameters ---------- obj : array of str or unicode-like itemsize : int, optional `itemsize` is the number of characters per scalar in the resulting array. If `itemsize` is None, and `obj` is an object array or a Python list, the `itemsize` will be automatically determined. If `itemsize` is provided and `obj` is of type str or unicode, then the `obj` string will be chunked into `itemsize` pieces. copy : bool, optional If true (default), then the object is copied. Otherwise, a copy will only be made if __array__ returns a copy, if obj is a nested sequence, or if a copy is needed to satisfy any of the other requirements (`itemsize`, unicode, `order`, etc.). unicode : bool, optional When true, the resulting `chararray` can contain Unicode characters, when false only 8-bit characters. If unicode is None and `obj` is one of the following: - a `chararray`, - an ndarray of type `str` or `unicode` - a Python str or unicode object, then the unicode setting of the output array will be automatically determined. order : {'C', 'F', 'A'}, optional Specify the order of the array. If order is 'C' (default), then the array will be in C-contiguous order (last-index varies the fastest). If order is 'F', then the returned array will be in Fortran-contiguous order (first-index varies the fastest). If order is 'A', then the returned array may be in any order (either C-, Fortran-contiguous, or even discontiguous). NTF)rdrrrrcr)rLrÚsubok)rHÚbytesrIr'rÚlistÚtuplerKrEr rJrLrMr ÚviewrdrrrVr‹ÚobjectrTÚnarray)r"rdrSrrrrLr(s rOrrª s€€õ~�#��s�|Ñ$Ô$ð 2Ø ˆ?ݘ#�sÑ#Ô#ð Ø��à�à Рݘ3‘x”xˆHÝ�C‘”˜HÑ$ˆå˜¨¸7Ø #¨5ð2ñ2ô2ð 2õ�#��e�}Ñ%Ô%ð!ÝŒm˜CÑ Ô ˆå�#•wÑÔñ ¥J¨s¬y¬~½yÑ$IÔ$Iñ õ˜#�yÑ)Ô)ð &Ø—(’(�9Ñ%Ô%ˆCà Ð Ø”|ˆHõ˜#œ)œ.­$Ñ/Ô/ð Ø˜Q‘�à ˆ?ݘ#œ)œ.­$Ñ/Ô/ð Ø��à�à ð ݈EˆEåˆEà Ð Ý”- ¨5Ð1Ñ1Ô1ˆCØ ð 5ؘSœ\Ò)Ð)Øð*Ý!+¨CµÑ!6Ô!6ð*àð*å'¨­VÑ4Ô4ð*ð—*’*˜e¥S¨¡]¤]Ð3Ñ4Ô4ˆC؈ å�#•wÑÔð¥J¨s¬y¬~½vÑ$FÔ$FðØ Ð ð—*’*‘,”,ˆCðð݈ˆåˆàÐÝ�S ¨U¸$Ð?Ñ?Ô?ˆˆå�S ¨Ð 1¸ÀdÐKÑKÔKˆØ �8Š8•IÑ Ô ÐrQcó*—t||d||¬¦«S)aÛ Convert the input to a `chararray`, copying the data only if necessary. Versus a regular NumPy array of type `str` or `unicode`, this class adds the following functionality: 1) values automatically have whitespace removed from the end when indexed 2) comparison operators automatically remove whitespace from the end when comparing values 3) vectorized string operations are provided as methods (e.g. `str.endswith`) and infix operators (e.g. ``+``, ``*``,``%``) Parameters ---------- obj : array of str or unicode-like itemsize : int, optional `itemsize` is the number of characters per scalar in the resulting array. If `itemsize` is None, and `obj` is an object array or a Python list, the `itemsize` will be automatically determined. If `itemsize` is provided and `obj` is of type str or unicode, then the `obj` string will be chunked into `itemsize` pieces. unicode : bool, optional When true, the resulting `chararray` can contain Unicode characters, when false only 8-bit characters. If unicode is None and `obj` is one of the following: - a `chararray`, - an ndarray of type `str` or 'unicode` - a Python str or unicode object, then the unicode setting of the output array will be automatically determined. order : {'C', 'F'}, optional Specify the order of the array. If order is 'C' (default), then the array will be in C-contiguous order (last-index varies the fastest). If order is 'F', then the returned array will be in Fortran-contiguous order (first-index varies the fastest). F)rSrrr)r"rdrrs rOrErE0 s'€õb ��h UØ ¨ð /ñ /ô /ð/rQrhr‚r„rƒr…)NTNN)NNN)fr‰Ú functoolsÚ_utilsrÚ numerictypesrrrr r r r Únumericr rrr‘Únumpy.core.multiarrayrÚ numpy.corerÚ numpy.compatrrKÚ__all__rÚpartialÚarray_function_dispatchrPr[rarWrmrrrrrrrzrrr†rr‘rrrœrrªr r±r!r"r¸r#r¾r$r%r&r'r(r)r*r+r,r-rÑr.rÔr/r0rÜr1rár2rçr3r4r5r6r7rðr8r9r:rùr;rþr<r=r>r?rr@rAr rBrCrDrrErirQrOúr�sì ðððð"ÐÐÐàÐÐÐÐÐð<ð<ð<ð<ð<ð<ð<ð<ð<ð<ð<ð<ð<ð<ð<ð<ð<ð<à0Ð0Ð0Ð0Ð0Ð0Ð0Ð0Ø$Ð$Ð$Ð$Ð$Ð$Ø-Ð-Ð-Ð-Ð-Ð-Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø € € € ð ð ð €ð€ à+˜)Ô+Ø Ô%¨lð<ñ<ô<Ððððð ð ð ð ðððð ððððððÐÐ.Ñ/Ô/ð2ð2ñ0Ô/ð2ð2ÐÐ.Ñ/Ô/ð2ð2ñ0Ô/ð2ð2ÐÐ.Ñ/Ô/ð2ð2ñ0Ô/ð2ð4ÐÐ.Ñ/Ô/ð2ð2ñ0Ô/ð2ð2ÐÐ.Ñ/Ô/ð1ð1ñ0Ô/ð1ð2ÐÐ.Ñ/Ô/ð1ð1ñ0Ô/ð1ð2ðððÐÐ-Ñ.Ô.ð +ð +ñ/Ô.ð +ðFÐÐ.Ñ/Ô/ð#Mð#Mñ0Ô/ð#MðJðððÐÐ-Ñ.Ô.ð+Að+Añ/Ô.ð+Að\ðððИÑ)Ô)ð:ð:ñ*Ô)ð:ð6ÐÐ-Ñ.Ô.ð#9ð#9ñ/Ô.ð#9ðLððððÐÐ+Ñ,Ô,ð1Ið1Ið1Iñ-Ô,ð1IðhððððÐÐ*Ñ+Ô+ð*Jð*Jð*Jñ,Ô+ð*JðZððððÐÐ)Ñ*Ô*ð*Jð*Jð*Jñ+Ô*ð*JðZÐÐ)Ñ*Ô*ð Jð Jð Jñ+Ô*ð JðFððððÐÐ-Ñ.Ô.ð(Bð(Bð(Bñ/Ô.ð(BðVððððÐÐ/Ñ0Ô0ð >ð >ð >ñ1Ô0ð >ðFÐÐ*Ñ+Ô+ð&:ð&:ð&:ñ,Ô+ð&:ðRÐÐ*Ñ+Ô+ð;ð;ð;ñ,Ô+ð;ðDÐÐ-Ñ.Ô.ð,ð,ñ/Ô.ð,ð2ÐÐ-Ñ.Ô.ð,ð,ñ/Ô.ð,ð2ÐÐ-Ñ.Ô.ð,ð,ñ/Ô.ð,ðDÐÐ-Ñ.Ô.ð,ð,ñ/Ô.ð,ð4ÐÐ-Ñ.Ô.ð,ð,ñ/Ô.ð,ð4ÐÐ-Ñ.Ô.ð,ð,ñ/Ô.ð,ð2ÐÐ-Ñ.Ô.ð!,ð!,ñ/Ô.ð!,ðHðððÐÐ)Ñ*Ô*ð8ð8ñ+Ô*ð8ðFððððÐÐ)Ñ*Ô*ð Hð Hð Hñ+Ô*ð HðFÐÐ-Ñ.Ô.ð4ð4ñ/Ô.ð4ðDððððÐÐ*Ñ+Ô+ð3?ð3?ð3?ñ,Ô+ð3?ðlðððÐÐ.Ñ/Ô/ð 9ð 9ñ0Ô/ð 9ðFððððÐÐ,Ñ-Ô-ð%Pð%Pð%Pñ.Ô-ð%PðPÐÐ*Ñ+Ô+ð;ð;ð;ñ,Ô+ð;ð@ÐÐ*Ñ+Ô+ð<ð<ð<ñ,Ô+ð<ð:ÐÐ)Ñ*Ô*ð Hð Hð Hñ+Ô*ð HðFÐÐ.Ñ/Ô/ð :ð :ñ0Ô/ð :ðFððððÐÐ*Ñ+Ô+ð"=ð"=ð"=ñ,Ô+ð"=ðJððððÐÐ*Ñ+Ô+ð)?ð)?ð)?ñ,Ô+ð)?ðXÐÐ*Ñ+Ô+ð<ð<ð<ñ,Ô+ð<ðDððððÐÐ/Ñ0Ô0ð9ð9ð9ñ1Ô0ð9ð:ððððÐÐ/Ñ0Ô0ðDðDðDñ1Ô0ðDð>ÐÐ*Ñ+Ô+ð)Hð)Hð)Hñ,Ô+ð)HðXÐÐ-Ñ.Ô.ð"7ð"7ñ/Ô.ð"7ðJÐÐ-Ñ.Ô.ð$4ð$4ñ/Ô.ð$4ðNððððÐÐ.Ñ/Ô/ð!Qð!Qð!Qñ0Ô/ð!QðHÐÐ-Ñ.Ô.ð4ð4ñ/Ô.ð4ðDðððÐÐ*Ñ+Ô+ð?ð?ñ,Ô+ð?ð<ÐÐ-Ñ.Ô.ð!.ð!.ñ/Ô.ð!.ðHÐÐ-Ñ.Ô.ð".ð".ñ/Ô.ð".ðJ €ˆGÑÔðd ðd ðd ðd ðd �ñd ôd ñÔðd ðN €ˆLÑÔðBðBðBñÔðBðJ €ˆLÑÔð1/ð1/ð1/ñÔð1/ð1/ð1/rQ