neulab/docprompting-conala huggingface dataset:
numpy.char.chararray.view method   char.chararray.view([dtype][, type])
 
New view of array with the same data.  Note Passing None for dtype is different from omitting the parameter, since the former invokes dtype(None) which is an alias for dtype('float_').   Parameters 
 
dtypedata-type or ndarray sub-class, optional


Data-type descriptor of the returned view, e.g., float32 or int16. Omitting it results in the view having the same data-type as a. This argument can also be specified as an ndarray sub-class, which then specifies the type of the returned object (this is equivalent to setting the type parameter).  
typePython type, optional


Type of the returned view, e.g., ndarray or matrix. Again, omission of the parameter results in type preservation.     Notes a.view() is used two different ways: a.view(some_dtype) or a.view(dtype=some_dtype) constructs a view of the array’s memory with a different data-type. This can cause a reinterpretation of the bytes of memory. a.view(ndarray_subclass) or a.view(type=ndarray_subclass) just returns an instance of ndarray_subclass that looks at the same array (same shape, dtype, etc.) This does not cause a reinterpretation of the memory. For a.view(some_dtype), if some_dtype has a different number of bytes per entry than the previous dtype (for example, converting a regular array to a structured array), then the behavior of the view cannot be predicted just from the superficial appearance of a (shown by print(a)). It also depends on exactly how a is stored in memory. Therefore if a is C-ordered versus fortran-ordered, versus defined as a slice or transpose, etc., the view may give different results. Examples >>> x = np.array([(1, 2)], dtype=[('a', np.int8), ('b', np.int8)])
 Viewing array data using a different type and dtype: >>> y = x.view(dtype=np.int16, type=np.matrix)
>>> y
matrix([[513]], dtype=int16)
>>> print(type(y))
<class 'numpy.matrix'>
 Creating a view on a structured array so it can be used in calculations >>> x = np.array([(1, 2),(3,4)], dtype=[('a', np.int8), ('b', np.int8)])
>>> xv = x.view(dtype=np.int8).reshape(-1,2)
>>> xv
array([[1, 2],
       [3, 4]], dtype=int8)
>>> xv.mean(0)
array([2.,  3.])
 Making changes to the view changes the underlying array >>> xv[0,1] = 20
>>> x
array([(1, 20), (3,  4)], dtype=[('a', 'i1'), ('b', 'i1')])
 Using a view to convert an array to a recarray: >>> z = x.view(np.recarray)
>>> z.a
array([1, 3], dtype=int8)
 Views share data: >>> x[0] = (9, 10)
>>> z[0]
(9, 10)
 Views that change the dtype size (bytes per entry) should normally be avoided on arrays defined by slices, transposes, fortran-ordering, etc.: >>> x = np.array([[1,2,3],[4,5,6]], dtype=np.int16)
>>> y = x[:, 0:2]
>>> y
array([[1, 2],
       [4, 5]], dtype=int16)
>>> y.view(dtype=[('width', np.int16), ('length', np.int16)])
Traceback (most recent call last):
    ...
ValueError: To change to a dtype of a different size, the array must be C-contiguous
>>> z = y.copy()
>>> z.view(dtype=[('width', np.int16), ('length', np.int16)])
array([[(1, 2)],
       [(4, 5)]], dtype=[('width', '<i2'), ('length', '<i2')])
numpy.char.chararray.zfill method   char.chararray.zfill(width)[source]
 
Return the numeric string left-filled with zeros in a string of length width.  See also  char.zfill
numpy.char.compare_chararrays   char.compare_chararrays(a1, a2, cmp, rstrip)
 
Performs element-wise comparison of two string arrays using the comparison operator specified by cmp_op.  Parameters 
 
a1, a2array_like


Arrays to be compared.  
cmp{“<”, “<=”, “==”, “>=”, “>”, “!=”}


Type of comparison.  
rstripBoolean


If True, the spaces at the end of Strings are removed before the comparison.    Returns 
 
outndarray


The output array of type Boolean with the same shape as a and b.    Raises 
 ValueError

If cmp_op is not valid.  TypeError

If at least one of a or b is a non-string array     Examples >>> a = np.array(["a", "b", "cde"])
>>> b = np.array(["a", "a", "dec"])
>>> np.compare_chararrays(a, b, ">", True)
array([False,  True, False])
numpy.char.count   char.count(a, sub, start=0, end=None)[source]
 
Returns an array with the number of non-overlapping occurrences of substring sub in the range [start, end]. Calls str.count element-wise.  Parameters 
 
aarray_like of str or unicode


substr or unicode


The substring to search for.  
start, endint, optional


Optional arguments start and end are interpreted as slice notation to specify the range in which to count.    Returns 
 
outndarray


Output array of ints.      See also  str.count
  Examples >>> c = np.array(['aAaAaA', '  aA  ', 'abBABba'])
>>> c
array(['aAaAaA', '  aA  ', 'abBABba'], dtype='<U7')
>>> 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])
numpy.char.decode   char.decode(a, encoding=None, errors=None)[source]
 
Calls str.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 codecs module.  Parameters 
 
aarray_like of str or unicode


encodingstr, optional


The name of an encoding  
errorsstr, optional


Specifies how to handle encoding errors    Returns 
 
outndarray

    See also  str.decode
  Notes The type of the result will depend on the encoding specified. Examples >>> c = np.array(['aAaAaA', '  aA  ', 'abBABba'])
>>> c
array(['aAaAaA', '  aA  ', 'abBABba'], dtype='<U7')
>>> np.char.encode(c, encoding='cp037')
array(['\x81\xc1\x81\xc1\x81\xc1', '@@\x81\xc1@@',
    '\x81\x82\xc2\xc1\xc2\x82\x81'],
    dtype='|S7')
numpy.char.encode   char.encode(a, encoding=None, errors=None)[source]
 
Calls str.encode element-wise. The set of available codecs comes from the Python standard library, and may be extended at runtime. For more information, see the codecs module.  Parameters 
 
aarray_like of str or unicode


encodingstr, optional


The name of an encoding  
errorsstr, optional


Specifies how to handle encoding errors    Returns 
 
outndarray

    See also  str.encode
  Notes The type of the result will depend on the encoding specified.
numpy.char.endswith   char.endswith(a, suffix, start=0, end=None)[source]
 
Returns a boolean array which is True where the string element in a ends with suffix, otherwise False. Calls str.endswith element-wise.  Parameters 
 
aarray_like of str or unicode


suffixstr


start, endint, optional


With optional start, test beginning at that position. With optional end, stop comparing at that position.    Returns 
 
outndarray


Outputs an array of bools.      See also  str.endswith
  Examples >>> s = np.array(['foo', 'bar'])
>>> s[0] = 'foo'
>>> s[1] = 'bar'
>>> s
array(['foo', 'bar'], dtype='<U3')
>>> np.char.endswith(s, 'ar')
array([False,  True])
>>> np.char.endswith(s, 'a', start=1, end=2)
array([False,  True])
numpy.char.equal   char.equal(x1, x2)[source]
 
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, x2array_like of str or unicode


Input arrays of the same shape.    Returns 
 
outndarray


Output array of bools.      See also  
not_equal, greater_equal, less_equal, greater, less
numpy.char.expandtabs   char.expandtabs(a, tabsize=8)[source]
 
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 
 
aarray_like of str or unicode


Input array  
tabsizeint, optional


Replace tabs with tabsize number of spaces. If not given defaults to 8 spaces.    Returns 
 
outndarray


Output array of str or unicode, depending on input type      See also  str.expandtabs
numpy.char.find   char.find(a, sub, start=0, end=None)[source]
 
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 
 
aarray_like of str or unicode


substr or unicode


start, endint, optional


Optional arguments start and end are interpreted as in slice notation.    Returns 
 
outndarray or int


Output array of ints. Returns -1 if sub is not found.      See also  str.find
numpy.char.greater   char.greater(x1, x2)[source]
 
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, x2array_like of str or unicode


Input arrays of the same shape.    Returns 
 
outndarray


Output array of bools.      See also  
equal, not_equal, greater_equal, less_equal, less
numpy.char.greater_equal   char.greater_equal(x1, x2)[source]
 
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, x2array_like of str or unicode


Input arrays of the same shape.    Returns 
 
outndarray


Output array of bools.      See also  
equal, not_equal, less_equal, greater, less
numpy.char.index   char.index(a, sub, start=0, end=None)[source]
 
Like find, but raises ValueError when the substring is not found. Calls str.index element-wise.  Parameters 
 
aarray_like of str or unicode


substr or unicode


start, endint, optional

  Returns 
 
outndarray


Output array of ints. Returns -1 if sub is not found.      See also  
find, str.find
numpy.char.isalnum   char.isalnum(a)[source]
 
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 
 
aarray_like of str or unicode

  Returns 
 
outndarray


Output array of str or unicode, depending on input type      See also  str.isalnum
numpy.char.isalpha   char.isalpha(a)[source]
 
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 
 
aarray_like of str or unicode

  Returns 
 
outndarray


Output array of bools      See also  str.isalpha
numpy.char.isdecimal   char.isdecimal(a)[source]
 
For each element, return True if there are only decimal characters in the element. Calls unicode.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 
 
aarray_like, unicode


Input array.    Returns 
 
outndarray, bool


Array of booleans identical in shape to a.      See also  unicode.isdecimal
numpy.char.isdigit   char.isdigit(a)[source]
 
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 
 
aarray_like of str or unicode

  Returns 
 
outndarray


Output array of bools      See also  str.isdigit
numpy.char.islower   char.islower(a)[source]
 
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 
 
aarray_like of str or unicode

  Returns 
 
outndarray


Output array of bools      See also  str.islower
numpy.char.isnumeric   char.isnumeric(a)[source]
 
For each element, return True if there are only numeric characters in the element. Calls unicode.isnumeric element-wise. Numeric characters include digit characters, and all characters that have the Unicode numeric value property, e.g. U+2155,
VULGAR FRACTION ONE FIFTH.  Parameters 
 
aarray_like, unicode


Input array.    Returns 
 
outndarray, bool


Array of booleans of same shape as a.      See also  unicode.isnumeric
numpy.char.isspace   char.isspace(a)[source]
 
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 
 
aarray_like of str or unicode

  Returns 
 
outndarray


Output array of bools      See also  str.isspace
numpy.char.istitle   char.istitle(a)[source]
 
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 
 
aarray_like of str or unicode

  Returns 
 
outndarray


Output array of bools      See also  str.istitle
numpy.char.isupper   char.isupper(a)[source]
 
Returns 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 
 
aarray_like of str or unicode

  Returns 
 
outndarray


Output array of bools      See also  str.isupper
numpy.char.join   char.join(sep, seq)[source]
 
Return a string which is the concatenation of the strings in the sequence seq. Calls str.join element-wise.  Parameters 
 
separray_like of str or unicode


seqarray_like of str or unicode

  Returns 
 
outndarray


Output array of str or unicode, depending on input types      See also  str.join
numpy.char.less   char.less(x1, x2)[source]
 
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, x2array_like of str or unicode


Input arrays of the same shape.    Returns 
 
outndarray


Output array of bools.      See also  
equal, not_equal, greater_equal, less_equal, greater
numpy.char.less_equal   char.less_equal(x1, x2)[source]
 
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, x2array_like of str or unicode


Input arrays of the same shape.    Returns 
 
outndarray


Output array of bools.      See also  
equal, not_equal, greater_equal, greater, less
numpy.char.ljust   char.ljust(a, width, fillchar=' ')[source]
 
Return an array with the elements of a left-justified in a string of length width. Calls str.ljust element-wise.  Parameters 
 
aarray_like of str or unicode


widthint


The length of the resulting strings  
fillcharstr or unicode, optional


The character to use for padding    Returns 
 
outndarray


Output array of str or unicode, depending on input type      See also  str.ljust
numpy.char.lower   char.lower(a)[source]
 
Return an array with the elements converted to lowercase. Call str.lower element-wise. For 8-bit strings, this method is locale-dependent.  Parameters 
 
aarray_like, {str, unicode}


Input array.    Returns 
 
outndarray, {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='<U5')
>>> np.char.lower(c)
array(['a1b c', '1bca', 'bca1'], dtype='<U5')
numpy.char.lstrip   char.lstrip(a, chars=None)[source]
 
For each element in a, return a copy with the leading characters removed. Calls str.lstrip element-wise.  Parameters 
 
aarray-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 
 
outndarray, {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='<U7')
 The ‘a’ variable is unstripped from c[1] because whitespace leading. >>> np.char.lstrip(c, 'a')
array(['AaAaA', '  aA  ', 'bBABba'], dtype='<U7')
 >>> np.char.lstrip(c, 'A') # leaves c unchanged
array(['aAaAaA', '  aA  ', 'abBABba'], dtype='<U7')
>>> (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
numpy.char.mod   char.mod(a, values)[source]
 
Return (a % i), that is pre-Python 2.6 string formatting (interpolation), element-wise for a pair of array_likes of str or unicode.  Parameters 
 
aarray_like of str or unicode


valuesarray_like of values


These values will be element-wise interpolated into the string.    Returns 
 
outndarray


Output array of str or unicode, depending on input types      See also  str.__mod__
numpy.char.multiply   char.multiply(a, i)[source]
 
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 
 
aarray_like of str or unicode


iarray_like of ints

  Returns 
 
outndarray


Output array of str or unicode, depending on input types
numpy.char.not_equal   char.not_equal(x1, x2)[source]
 
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, x2array_like of str or unicode


Input arrays of the same shape.    Returns 
 
outndarray


Output array of bools.      See also  
equal, greater_equal, less_equal, greater, less
numpy.char.partition   char.partition(a, sep)[source]
 
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 
 
aarray_like, {str, unicode}


Input array  
sep{str, unicode}


Separator to split each string element in a.    Returns 
 
outndarray, {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
numpy.char.replace   char.replace(a, old, new, count=None)[source]
 
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 
 
aarray-like of str or unicode


old, newstr or unicode


countint, optional


If the optional argument count is given, only the first count occurrences are replaced.    Returns 
 
outndarray


Output array of str or unicode, depending on input type      See also  str.replace
numpy.char.rfind   char.rfind(a, sub, start=0, end=None)[source]
 
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 
 
aarray-like of str or unicode


substr or unicode


start, endint, optional


Optional arguments start and end are interpreted as in slice notation.    Returns 
 
outndarray


Output array of ints. Return -1 on failure.      See also  str.rfind
numpy.char.rindex   char.rindex(a, sub, start=0, end=None)[source]
 
Like rfind, but raises ValueError when the substring sub is not found. Calls str.rindex element-wise.  Parameters 
 
aarray-like of str or unicode


substr or unicode


start, endint, optional

  Returns 
 
outndarray


Output array of ints.      See also  
rfind, str.rindex
numpy.char.rjust   char.rjust(a, width, fillchar=' ')[source]
 
Return an array with the elements of a right-justified in a string of length width. Calls str.rjust element-wise.  Parameters 
 
aarray_like of str or unicode


widthint


The length of the resulting strings  
fillcharstr or unicode, optional


The character to use for padding    Returns 
 
outndarray


Output array of str or unicode, depending on input type      See also  str.rjust
numpy.char.rpartition   char.rpartition(a, sep)[source]
 
Partition (split) each element around the right-most separator. Calls str.rpartition element-wise. For each element in a, split the element as the last 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 
 
aarray_like of str or unicode


Input array  
sepstr or unicode


Right-most separator to split each element in array.    Returns 
 
outndarray


Output array of string or unicode, depending on input type. The output array will have an extra dimension with 3 elements per input element.      See also  str.rpartition
numpy.char.rsplit   char.rsplit(a, sep=None, maxsplit=None)[source]
 
For each element in a, return a list of the words in the string, using sep as the delimiter string. Calls str.rsplit element-wise. Except for splitting from the right, rsplit behaves like split.  Parameters 
 
aarray_like of str or unicode


sepstr or unicode, optional


If sep is not specified or None, any whitespace string is a separator.  
maxsplitint, optional


If maxsplit is given, at most maxsplit splits are done, the rightmost ones.    Returns 
 
outndarray


Array of list objects      See also  
str.rsplit, split
numpy.char.rstrip   char.rstrip(a, chars=None)[source]
 
For each element in a, return a copy with the trailing characters removed. Calls str.rstrip element-wise.  Parameters 
 
aarray-like of str or unicode


charsstr or 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 suffix; rather, all combinations of its values are stripped.    Returns 
 
outndarray


Output array of str or unicode, depending on input type      See also  str.rstrip
  Examples >>> 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')
numpy.char.split   char.split(a, sep=None, maxsplit=None)[source]
 
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 
 
aarray_like of str or unicode


sepstr or unicode, optional


If sep is not specified or None, any whitespace string is a separator.  
maxsplitint, optional


If maxsplit is given, at most maxsplit splits are done.    Returns 
 
outndarray


Array of list objects      See also  
str.split, rsplit
numpy.char.splitlines   char.splitlines(a, keepends=None)[source]
 
For each element in a, return a list of the lines in the element, breaking at line boundaries. Calls str.splitlines element-wise.  Parameters 
 
aarray_like of str or unicode


keependsbool, optional


Line breaks are not included in the resulting list unless keepends is given and true.    Returns 
 
outndarray


Array of list objects      See also  str.splitlines