neulab/docprompting-conala huggingface dataset:
numpy.char.startswith   char.startswith(a, prefix, start=0, end=None)[source]
 
Returns a boolean array which is True where the string element in a starts with prefix, otherwise False. Calls str.startswith element-wise.  Parameters 
 
aarray_like of str or unicode


prefixstr


start, endint, optional


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


Array of booleans      See also  str.startswith
numpy.char.str_len   char.str_len(a)[source]
 
Return len(a) element-wise.  Parameters 
 
aarray_like of str or unicode

  Returns 
 
outndarray


Output array of integers      See also  builtins.len
numpy.char.strip   char.strip(a, chars=None)[source]
 
For each element in a, return a copy with the leading and trailing characters removed. Calls str.strip 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 prefix or suffix; rather, all combinations of its values are stripped.    Returns 
 
outndarray


Output array of str or unicode, depending on input type      See also  str.strip
  Examples >>> c = np.array(['aAaAaA', '  aA  ', 'abBABba'])
>>> c
array(['aAaAaA', '  aA  ', 'abBABba'], dtype='<U7')
>>> np.char.strip(c)
array(['aAaAaA', 'aA', 'abBABba'], dtype='<U7')
>>> np.char.strip(c, 'a') # 'a' unstripped from c[1] because whitespace leads
array(['AaAaA', '  aA  ', 'bBABb'], dtype='<U7')
>>> np.char.strip(c, 'A') # 'A' unstripped from c[1] because (unprinted) ws trails
array(['aAaAa', '  aA  ', 'abBABba'], dtype='<U7')
numpy.char.swapcase   char.swapcase(a)[source]
 
Return element-wise a copy of the string with uppercase characters converted to lowercase and vice versa. Calls str.swapcase 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.swapcase
  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.swapcase(c)
array(['A1b C', '1B cA', 'B cA1', 'Ca1B'],
    dtype='|S5')
numpy.char.title   char.title(a)[source]
 
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 
 
aarray_like, {str, unicode}


Input array.    Returns 
 
outndarray


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')
numpy.char.translate   char.translate(a, table, deletechars=None)[source]
 
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 
 
aarray-like of str or unicode


tablestr of length 256


deletecharsstr

  Returns 
 
outndarray


Output array of str or unicode, depending on input type      See also  str.translate
numpy.char.upper   char.upper(a)[source]
 
Return an array with the elements converted to uppercase. Calls str.upper 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.upper
  Examples >>> c = np.array(['a1b c', '1bca', 'bca1']); c
array(['a1b c', '1bca', 'bca1'], dtype='<U5')
>>> np.char.upper(c)
array(['A1B C', '1BCA', 'BCA1'], dtype='<U5')
numpy.char.zfill   char.zfill(a, width)[source]
 
Return the numeric string left-filled with zeros Calls str.zfill element-wise.  Parameters 
 
aarray_like, {str, unicode}


Input array.  
widthint


Width of string to left-fill elements in a.    Returns 
 
outndarray, {str, unicode}


Output array of str or unicode, depending on input type      See also  str.zfill
numpy.chararray.argsort method   chararray.argsort(axis=- 1, kind=None, order=None)[source]
 
Returns the indices that would sort this array. Refer to numpy.argsort for full documentation.  See also  numpy.argsort

equivalent function
numpy.chararray.astype method   chararray.astype(dtype, order='K', casting='unsafe', subok=True, copy=True)
 
Copy of the array, cast to a specified type.  Parameters 
 
dtypestr or dtype


Typecode or data-type to which the array is cast.  
order{‘C’, ‘F’, ‘A’, ‘K’}, optional


Controls the memory layout order of the result. ‘C’ means C order, ‘F’ means Fortran order, ‘A’ means ‘F’ order if all the arrays are Fortran contiguous, ‘C’ order otherwise, and ‘K’ means as close to the order the array elements appear in memory as possible. Default is ‘K’.  
casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optional


Controls what kind of data casting may occur. Defaults to ‘unsafe’ for backwards compatibility.  ‘no’ means the data types should not be cast at all. ‘equiv’ means only byte-order changes are allowed. ‘safe’ means only casts which can preserve values are allowed. ‘same_kind’ means only safe casts or casts within a kind, like float64 to float32, are allowed. ‘unsafe’ means any data conversions may be done.   
subokbool, optional


If True, then sub-classes will be passed-through (default), otherwise the returned array will be forced to be a base-class array.  
copybool, optional


By default, astype always returns a newly allocated array. If this is set to false, and the dtype, order, and subok requirements are satisfied, the input array is returned instead of a copy.    Returns 
 
arr_tndarray


Unless copy is False and the other conditions for returning the input array are satisfied (see description for copy input parameter), arr_t is a new array of the same shape as the input array, with dtype, order given by dtype, order.    Raises 
 ComplexWarning

When casting from complex to float or int. To avoid this, one should use a.real.astype(t).     Notes  Changed in version 1.17.0: Casting between a simple data type and a structured one is possible only for “unsafe” casting. Casting to multiple fields is allowed, but casting from multiple fields is not.   Changed in version 1.9.0: Casting from numeric to string types in ‘safe’ casting mode requires that the string dtype length is long enough to store the max integer/float value converted.  Examples >>> x = np.array([1, 2, 2.5])
>>> x
array([1. ,  2. ,  2.5])
 >>> x.astype(int)
array([1, 2, 2])
numpy.chararray.base attribute   chararray.base
 
Base object if memory is from some other object. Examples The base of an array that owns its memory is None: >>> x = np.array([1,2,3,4])
>>> x.base is None
True
 Slicing creates a view, whose memory is shared with x: >>> y = x[2:]
>>> y.base is x
True
numpy.chararray.copy method   chararray.copy(order='C')
 
Return a copy of the array.  Parameters 
 
order{‘C’, ‘F’, ‘A’, ‘K’}, optional


Controls the memory layout of the copy. ‘C’ means C-order, ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of a as closely as possible. (Note that this function and numpy.copy are very similar but have different default values for their order= arguments, and this function always passes sub-classes through.)      See also  numpy.copy

Similar function with different default behavior  numpy.copyto
  Notes This function is the preferred method for creating an array copy. The function numpy.copy is similar, but it defaults to using order ‘K’, and will not pass sub-classes through by default. Examples >>> x = np.array([[1,2,3],[4,5,6]], order='F')
 >>> y = x.copy()
 >>> x.fill(0)
 >>> x
array([[0, 0, 0],
       [0, 0, 0]])
 >>> y
array([[1, 2, 3],
       [4, 5, 6]])
 >>> y.flags['C_CONTIGUOUS']
True
numpy.chararray.count method   chararray.count(sub, start=0, end=None)[source]
 
Returns an array with the number of non-overlapping occurrences of substring sub in the range [start, end].  See also  char.count
numpy.chararray.data attribute   chararray.data
 
Python buffer object pointing to the start of the array’s data.
numpy.chararray.decode method   chararray.decode(encoding=None, errors=None)[source]
 
Calls str.decode element-wise.  See also  char.decode
numpy.chararray.dump method   chararray.dump(file)
 
Dump a pickle of the array to the specified file. The array can be read back with pickle.load or numpy.load.  Parameters 
 
filestr or Path


A string naming the dump file.  Changed in version 1.17.0: pathlib.Path objects are now accepted.
numpy.chararray.dumps method   chararray.dumps()
 
Returns the pickle of the array as a string. pickle.loads will convert the string back to an array.  Parameters 
 None
numpy.chararray.encode method   chararray.encode(encoding=None, errors=None)[source]
 
Calls str.encode element-wise.  See also  char.encode
numpy.chararray.endswith method   chararray.endswith(suffix, start=0, end=None)[source]
 
Returns a boolean array which is True where the string element in self ends with suffix, otherwise False.  See also  char.endswith
numpy.chararray.expandtabs method   chararray.expandtabs(tabsize=8)[source]
 
Return a copy of each string element where all tab characters are replaced by one or more spaces.  See also  char.expandtabs
numpy.chararray.fill method   chararray.fill(value)
 
Fill the array with a scalar value.  Parameters 
 
valuescalar


All elements of a will be assigned this value.     Examples >>> a = np.array([1, 2])
>>> a.fill(0)
>>> a
array([0, 0])
>>> a = np.empty(2)
>>> a.fill(1)
>>> a
array([1.,  1.])
numpy.chararray.find method   chararray.find(sub, start=0, end=None)[source]
 
For each element, return the lowest index in the string where substring sub is found.  See also  char.find
numpy.chararray.flags attribute   chararray.flags
 
Information about the memory layout of the array. Notes The flags object can be accessed dictionary-like (as in a.flags['WRITEABLE']), or by using lowercased attribute names (as in a.flags.writeable). Short flag names are only supported in dictionary access. Only the WRITEBACKIFCOPY, UPDATEIFCOPY, WRITEABLE, and ALIGNED flags can be changed by the user, via direct assignment to the attribute or dictionary entry, or by calling ndarray.setflags. The array flags cannot be set arbitrarily:  UPDATEIFCOPY can only be set False. WRITEBACKIFCOPY can only be set False. ALIGNED can only be set True if the data is truly aligned. WRITEABLE can only be set True if the array owns its own memory or the ultimate owner of the memory exposes a writeable buffer interface or is a string.  Arrays can be both C-style and Fortran-style contiguous simultaneously. This is clear for 1-dimensional arrays, but can also be true for higher dimensional arrays. Even for contiguous arrays a stride for a given dimension arr.strides[dim] may be arbitrary if arr.shape[dim] == 1 or the array has no elements. It does not generally hold that self.strides[-1] == self.itemsize for C-style contiguous arrays or self.strides[0] == self.itemsize for Fortran-style contiguous arrays is true.  Attributes 
 C_CONTIGUOUS (C)

The data is in a single, C-style contiguous segment.  F_CONTIGUOUS (F)

The data is in a single, Fortran-style contiguous segment.  OWNDATA (O)

The array owns the memory it uses or borrows it from another object.  WRITEABLE (W)

The data area can be written to. Setting this to False locks the data, making it read-only. A view (slice, etc.) inherits WRITEABLE from its base array at creation time, but a view of a writeable array may be subsequently locked while the base array remains writeable. (The opposite is not true, in that a view of a locked array may not be made writeable. However, currently, locking a base object does not lock any views that already reference it, so under that circumstance it is possible to alter the contents of a locked array via a previously created writeable view onto it.) Attempting to change a non-writeable array raises a RuntimeError exception.  ALIGNED (A)

The data and all elements are aligned appropriately for the hardware.  WRITEBACKIFCOPY (X)

This array is a copy of some other array. The C-API function PyArray_ResolveWritebackIfCopy must be called before deallocating to the base array will be updated with the contents of this array.  UPDATEIFCOPY (U)

(Deprecated, use WRITEBACKIFCOPY) This array is a copy of some other array. When this array is deallocated, the base array will be updated with the contents of this array.  FNC

F_CONTIGUOUS and not C_CONTIGUOUS.  FORC

F_CONTIGUOUS or C_CONTIGUOUS (one-segment test).  BEHAVED (B)

ALIGNED and WRITEABLE.  CARRAY (CA)

BEHAVED and C_CONTIGUOUS.  FARRAY (FA)

BEHAVED and F_CONTIGUOUS and not C_CONTIGUOUS.
numpy.chararray.flat attribute   chararray.flat
 
A 1-D iterator over the array. This is a numpy.flatiter instance, which acts similarly to, but is not a subclass of, Python’s built-in iterator object.  See also  flatten

Return a copy of the array collapsed into one dimension.  flatiter
  Examples >>> x = np.arange(1, 7).reshape(2, 3)
>>> x
array([[1, 2, 3],
       [4, 5, 6]])
>>> x.flat[3]
4
>>> x.T
array([[1, 4],
       [2, 5],
       [3, 6]])
>>> x.T.flat[3]
5
>>> type(x.flat)
<class 'numpy.flatiter'>
 An assignment example: >>> x.flat = 3; x
array([[3, 3, 3],
       [3, 3, 3]])
>>> x.flat[[1,4]] = 1; x
array([[3, 1, 3],
       [3, 1, 3]])
numpy.chararray.flatten method   chararray.flatten(order='C')
 
Return a copy of the array collapsed into one dimension.  Parameters 
 
order{‘C’, ‘F’, ‘A’, ‘K’}, optional


‘C’ means to flatten in row-major (C-style) order. ‘F’ means to flatten in column-major (Fortran- style) order. ‘A’ means to flatten in column-major order if a is Fortran contiguous in memory, row-major order otherwise. ‘K’ means to flatten a in the order the elements occur in memory. The default is ‘C’.    Returns 
 
yndarray


A copy of the input array, flattened to one dimension.      See also  ravel

Return a flattened array.  flat

A 1-D flat iterator over the array.    Examples >>> a = np.array([[1,2], [3,4]])
>>> a.flatten()
array([1, 2, 3, 4])
>>> a.flatten('F')
array([1, 3, 2, 4])
numpy.chararray.getfield method   chararray.getfield(dtype, offset=0)
 
Returns a field of the given array as a certain type. A field is a view of the array data with a given data-type. The values in the view are determined by the given type and the offset into the current array in bytes. The offset needs to be such that the view dtype fits in the array dtype; for example an array of dtype complex128 has 16-byte elements. If taking a view with a 32-bit integer (4 bytes), the offset needs to be between 0 and 12 bytes.  Parameters 
 
dtypestr or dtype


The data type of the view. The dtype size of the view can not be larger than that of the array itself.  
offsetint


Number of bytes to skip before beginning the element view.     Examples >>> x = np.diag([1.+1.j]*2)
>>> x[1, 1] = 2 + 4.j
>>> x
array([[1.+1.j,  0.+0.j],
       [0.+0.j,  2.+4.j]])
>>> x.getfield(np.float64)
array([[1.,  0.],
       [0.,  2.]])
 By choosing an offset of 8 bytes we can select the complex part of the array for our view: >>> x.getfield(np.float64, offset=8)
array([[1.,  0.],
       [0.,  4.]])
numpy.chararray.index method   chararray.index(sub, start=0, end=None)[source]
 
Like find, but raises ValueError when the substring is not found.  See also  char.index
numpy.chararray.isalnum method   chararray.isalnum()[source]
 
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
numpy.chararray.isalpha method   chararray.isalpha()[source]
 
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
numpy.chararray.isdecimal method   chararray.isdecimal()[source]
 
For each element in self, return True if there are only decimal characters in the element.  See also  char.isdecimal
numpy.chararray.isdigit method   chararray.isdigit()[source]
 
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
numpy.chararray.islower method   chararray.islower()[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.  See also  char.islower
numpy.chararray.isnumeric method   chararray.isnumeric()[source]
 
For each element in self, return True if there are only numeric characters in the element.  See also  char.isnumeric
numpy.chararray.isspace method   chararray.isspace()[source]
 
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
numpy.chararray.istitle method   chararray.istitle()[source]
 
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
numpy.chararray.isupper method   chararray.isupper()[source]
 
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
numpy.chararray.item method   chararray.item(*args)
 
Copy an element of an array to a standard Python scalar and return it.  Parameters 
 
*argsArguments (variable number and type)


 none: in this case, the method only works for arrays with one element (a.size == 1), which element is copied into a standard Python scalar object and returned. int_type: this argument is interpreted as a flat index into the array, specifying which element to copy and return. tuple of int_types: functions as does a single int_type argument, except that the argument is interpreted as an nd-index into the array.     Returns 
 
zStandard Python scalar object


A copy of the specified element of the array as a suitable Python scalar     Notes When the data type of a is longdouble or clongdouble, item() returns a scalar array object because there is no available Python scalar that would not lose information. Void arrays return a buffer object for item(), unless fields are defined, in which case a tuple is returned. item is very similar to a[args], except, instead of an array scalar, a standard Python scalar is returned. This can be useful for speeding up access to elements of the array and doing arithmetic on elements of the array using Python’s optimized math. Examples >>> np.random.seed(123)
>>> x = np.random.randint(9, size=(3, 3))
>>> x
array([[2, 2, 6],
       [1, 3, 6],
       [1, 0, 1]])
>>> x.item(3)
1
>>> x.item(7)
0
>>> x.item((0, 1))
2
>>> x.item((2, 2))
1
numpy.chararray.itemsize attribute   chararray.itemsize
 
Length of one array element in bytes. Examples >>> x = np.array([1,2,3], dtype=np.float64)
>>> x.itemsize
8
>>> x = np.array([1,2,3], dtype=np.complex128)
>>> x.itemsize
16
numpy.chararray.join method   chararray.join(seq)[source]
 
Return a string which is the concatenation of the strings in the sequence seq.  See also  char.join
numpy.chararray.ljust method   chararray.ljust(width, fillchar=' ')[source]
 
Return an array with the elements of self left-justified in a string of length width.  See also  char.ljust
numpy.chararray.lower method   chararray.lower()[source]
 
Return an array with the elements of self converted to lowercase.  See also  char.lower
numpy.chararray.lstrip method   chararray.lstrip(chars=None)[source]
 
For each element in self, return a copy with the leading characters removed.  See also  char.lstrip
numpy.chararray.nbytes attribute   chararray.nbytes
 
Total bytes consumed by the elements of the array. Notes Does not include memory consumed by non-element attributes of the array object. Examples >>> x = np.zeros((3,5,2), dtype=np.complex128)
>>> x.nbytes
480
>>> np.prod(x.shape) * x.itemsize
480
numpy.chararray.ndim attribute   chararray.ndim
 
Number of array dimensions. Examples >>> x = np.array([1, 2, 3])
>>> x.ndim
1
>>> y = np.zeros((2, 3, 4))
>>> y.ndim
3
numpy.chararray.nonzero method   chararray.nonzero()
 
Return the indices of the elements that are non-zero. Refer to numpy.nonzero for full documentation.  See also  numpy.nonzero

equivalent function
numpy.chararray.put method   chararray.put(indices, values, mode='raise')
 
Set a.flat[n] = values[n] for all n in indices. Refer to numpy.put for full documentation.  See also  numpy.put

equivalent function
numpy.chararray.ravel method   chararray.ravel([order])
 
Return a flattened array. Refer to numpy.ravel for full documentation.  See also  numpy.ravel

equivalent function  ndarray.flat

a flat iterator on the array.
numpy.chararray.repeat method   chararray.repeat(repeats, axis=None)
 
Repeat elements of an array. Refer to numpy.repeat for full documentation.  See also  numpy.repeat

equivalent function
numpy.chararray.replace method   chararray.replace(old, new, count=None)[source]
 
For each element in self, return a copy of the string with all occurrences of substring old replaced by new.  See also  char.replace
numpy.chararray.reshape method   chararray.reshape(shape, order='C')
 
Returns an array containing the same data with a new shape. Refer to numpy.reshape for full documentation.  See also  numpy.reshape

equivalent function    Notes Unlike the free function numpy.reshape, this method on ndarray allows the elements of the shape parameter to be passed in as separate arguments. For example, a.reshape(10, 11) is equivalent to a.reshape((10, 11)).
numpy.chararray.resize method   chararray.resize(new_shape, refcheck=True)
 
Change shape and size of array in-place.  Parameters 
 
new_shapetuple of ints, or n ints


Shape of resized array.  
refcheckbool, optional


If False, reference count will not be checked. Default is True.    Returns 
 None
  Raises 
 ValueError

If a does not own its own data or references or views to it exist, and the data memory must be changed. PyPy only: will always raise if the data memory must be changed, since there is no reliable way to determine if references or views to it exist.  SystemError

If the order keyword argument is specified. This behaviour is a bug in NumPy.      See also  resize

Return a new array with the specified shape.    Notes This reallocates space for the data area if necessary. Only contiguous arrays (data elements consecutive in memory) can be resized. The purpose of the reference count check is to make sure you do not use this array as a buffer for another Python object and then reallocate the memory. However, reference counts can increase in other ways so if you are sure that you have not shared the memory for this array with another Python object, then you may safely set refcheck to False. Examples Shrinking an array: array is flattened (in the order that the data are stored in memory), resized, and reshaped: >>> a = np.array([[0, 1], [2, 3]], order='C')
>>> a.resize((2, 1))
>>> a
array([[0],
       [1]])
 >>> a = np.array([[0, 1], [2, 3]], order='F')
>>> a.resize((2, 1))
>>> a
array([[0],
       [2]])
 Enlarging an array: as above, but missing entries are filled with zeros: >>> b = np.array([[0, 1], [2, 3]])
>>> b.resize(2, 3) # new_shape parameter doesn't have to be a tuple
>>> b
array([[0, 1, 2],
       [3, 0, 0]])
 Referencing an array prevents resizing… >>> c = a
>>> a.resize((1, 1))
Traceback (most recent call last):
...
ValueError: cannot resize an array that references or is referenced ...
 Unless refcheck is False: >>> a.resize((1, 1), refcheck=False)
>>> a
array([[0]])
>>> c
array([[0]])
numpy.chararray.rfind method   chararray.rfind(sub, start=0, end=None)[source]
 
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