neulab/docprompting-conala huggingface dataset:
numpy.recarray.setfield method   recarray.setfield(val, dtype, offset=0)
 
Put a value into a specified place in a field defined by a data-type. Place val into a’s field defined by dtype and beginning offset bytes into the field.  Parameters 
 
valobject


Value to be placed in field.  
dtypedtype object


Data-type of the field in which to place val.  
offsetint, optional


The number of bytes into the field at which to place val.    Returns 
 None
    See also  getfield
  Examples >>> x = np.eye(3)
>>> x.getfield(np.float64)
array([[1.,  0.,  0.],
       [0.,  1.,  0.],
       [0.,  0.,  1.]])
>>> x.setfield(3, np.int32)
>>> x.getfield(np.int32)
array([[3, 3, 3],
       [3, 3, 3],
       [3, 3, 3]], dtype=int32)
>>> x
array([[1.0e+000, 1.5e-323, 1.5e-323],
       [1.5e-323, 1.0e+000, 1.5e-323],
       [1.5e-323, 1.5e-323, 1.0e+000]])
>>> x.setfield(np.eye(3), np.int32)
>>> x
array([[1.,  0.,  0.],
       [0.,  1.,  0.],
       [0.,  0.,  1.]])
numpy.recarray.setflags method   recarray.setflags(write=None, align=None, uic=None)
 
Set array flags WRITEABLE, ALIGNED, (WRITEBACKIFCOPY and UPDATEIFCOPY), respectively. These Boolean-valued flags affect how numpy interprets the memory area used by a (see Notes below). The ALIGNED flag can only be set to True if the data is actually aligned according to the type. The WRITEBACKIFCOPY and (deprecated) UPDATEIFCOPY flags can never be set to True. The flag WRITEABLE can only be set to True if the array owns its own memory, or the ultimate owner of the memory exposes a writeable buffer interface, or is a string. (The exception for string is made so that unpickling can be done without copying memory.)  Parameters 
 
writebool, optional


Describes whether or not a can be written to.  
alignbool, optional


Describes whether or not a is aligned properly for its type.  
uicbool, optional


Describes whether or not a is a copy of another “base” array.     Notes Array flags provide information about how the memory area used for the array is to be interpreted. There are 7 Boolean flags in use, only four of which can be changed by the user: WRITEBACKIFCOPY, UPDATEIFCOPY, WRITEABLE, and ALIGNED. WRITEABLE (W) the data area can be written to; ALIGNED (A) the data and strides are aligned appropriately for the hardware (as determined by the compiler); UPDATEIFCOPY (U) (deprecated), replaced by WRITEBACKIFCOPY; WRITEBACKIFCOPY (X) this array is a copy of some other array (referenced by .base). When the C-API function PyArray_ResolveWritebackIfCopy is called, the base array will be updated with the contents of this array. All flags can be accessed using the single (upper case) letter as well as the full name. Examples >>> y = np.array([[3, 1, 7],
...               [2, 0, 0],
...               [8, 5, 9]])
>>> y
array([[3, 1, 7],
       [2, 0, 0],
       [8, 5, 9]])
>>> y.flags
  C_CONTIGUOUS : True
  F_CONTIGUOUS : False
  OWNDATA : True
  WRITEABLE : True
  ALIGNED : True
  WRITEBACKIFCOPY : False
  UPDATEIFCOPY : False
>>> y.setflags(write=0, align=0)
>>> y.flags
  C_CONTIGUOUS : True
  F_CONTIGUOUS : False
  OWNDATA : True
  WRITEABLE : False
  ALIGNED : False
  WRITEBACKIFCOPY : False
  UPDATEIFCOPY : False
>>> y.setflags(uic=1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: cannot set WRITEBACKIFCOPY flag to True
numpy.recarray.size attribute   recarray.size
 
Number of elements in the array. Equal to np.prod(a.shape), i.e., the product of the array’s dimensions. Notes a.size returns a standard arbitrary precision Python integer. This may not be the case with other methods of obtaining the same value (like the suggested np.prod(a.shape), which returns an instance of np.int_), and may be relevant if the value is used further in calculations that may overflow a fixed size integer type. Examples >>> x = np.zeros((3, 5, 2), dtype=np.complex128)
>>> x.size
30
>>> np.prod(x.shape)
30
numpy.recarray.sort method   recarray.sort(axis=- 1, kind=None, order=None)
 
Sort an array in-place. Refer to numpy.sort for full documentation.  Parameters 
 
axisint, optional


Axis along which to sort. Default is -1, which means sort along the last axis.  
kind{‘quicksort’, ‘mergesort’, ‘heapsort’, ‘stable’}, optional


Sorting algorithm. The default is ‘quicksort’. Note that both ‘stable’ and ‘mergesort’ use timsort under the covers and, in general, the actual implementation will vary with datatype. The ‘mergesort’ option is retained for backwards compatibility.  Changed in version 1.15.0: The ‘stable’ option was added.   
orderstr or list of str, optional


When a is an array with fields defined, this argument specifies which fields to compare first, second, etc. A single field can be specified as a string, and not all fields need be specified, but unspecified fields will still be used, in the order in which they come up in the dtype, to break ties.      See also  numpy.sort

Return a sorted copy of an array.  numpy.argsort

Indirect sort.  numpy.lexsort

Indirect stable sort on multiple keys.  numpy.searchsorted

Find elements in sorted array.  numpy.partition

Partial sort.    Notes See numpy.sort for notes on the different sorting algorithms. Examples >>> a = np.array([[1,4], [3,1]])
>>> a.sort(axis=1)
>>> a
array([[1, 4],
       [1, 3]])
>>> a.sort(axis=0)
>>> a
array([[1, 3],
       [1, 4]])
 Use the order keyword to specify a field to use when sorting a structured array: >>> a = np.array([('a', 2), ('c', 1)], dtype=[('x', 'S1'), ('y', int)])
>>> a.sort(order='y')
>>> a
array([(b'c', 1), (b'a', 2)],
      dtype=[('x', 'S1'), ('y', '<i8')])
numpy.recarray.squeeze method   recarray.squeeze(axis=None)
 
Remove axes of length one from a. Refer to numpy.squeeze for full documentation.  See also  numpy.squeeze

equivalent function
numpy.recarray.std method   recarray.std(axis=None, dtype=None, out=None, ddof=0, keepdims=False, *, where=True)
 
Returns the standard deviation of the array elements along given axis. Refer to numpy.std for full documentation.  See also  numpy.std

equivalent function
numpy.recarray.strides attribute   recarray.strides
 
Tuple of bytes to step in each dimension when traversing an array. The byte offset of element (i[0], i[1], ..., i[n]) in an array a is: offset = sum(np.array(i) * a.strides)
 A more detailed explanation of strides can be found in the “ndarray.rst” file in the NumPy reference guide.  See also  numpy.lib.stride_tricks.as_strided
  Notes Imagine an array of 32-bit integers (each 4 bytes): x = np.array([[0, 1, 2, 3, 4],
              [5, 6, 7, 8, 9]], dtype=np.int32)
 This array is stored in memory as 40 bytes, one after the other (known as a contiguous block of memory). The strides of an array tell us how many bytes we have to skip in memory to move to the next position along a certain axis. For example, we have to skip 4 bytes (1 value) to move to the next column, but 20 bytes (5 values) to get to the same position in the next row. As such, the strides for the array x will be (20, 4). Examples >>> y = np.reshape(np.arange(2*3*4), (2,3,4))
>>> y
array([[[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]],
       [[12, 13, 14, 15],
        [16, 17, 18, 19],
        [20, 21, 22, 23]]])
>>> y.strides
(48, 16, 4)
>>> y[1,1,1]
17
>>> offset=sum(y.strides * np.array((1,1,1)))
>>> offset/y.itemsize
17
 >>> x = np.reshape(np.arange(5*6*7*8), (5,6,7,8)).transpose(2,3,1,0)
>>> x.strides
(32, 4, 224, 1344)
>>> i = np.array([3,5,2,2])
>>> offset = sum(i * x.strides)
>>> x[3,5,2,2]
813
>>> offset / x.itemsize
813
numpy.recarray.sum method   recarray.sum(axis=None, dtype=None, out=None, keepdims=False, initial=0, where=True)
 
Return the sum of the array elements over the given axis. Refer to numpy.sum for full documentation.  See also  numpy.sum

equivalent function
numpy.recarray.swapaxes method   recarray.swapaxes(axis1, axis2)
 
Return a view of the array with axis1 and axis2 interchanged. Refer to numpy.swapaxes for full documentation.  See also  numpy.swapaxes

equivalent function
numpy.recarray.T attribute   recarray.T
 
The transposed array. Same as self.transpose().  See also  transpose
  Examples >>> x = np.array([[1.,2.],[3.,4.]])
>>> x
array([[ 1.,  2.],
       [ 3.,  4.]])
>>> x.T
array([[ 1.,  3.],
       [ 2.,  4.]])
>>> x = np.array([1.,2.,3.,4.])
>>> x
array([ 1.,  2.,  3.,  4.])
>>> x.T
array([ 1.,  2.,  3.,  4.])
numpy.recarray.take method   recarray.take(indices, axis=None, out=None, mode='raise')
 
Return an array formed from the elements of a at the given indices. Refer to numpy.take for full documentation.  See also  numpy.take

equivalent function
numpy.recarray.tobytes method   recarray.tobytes(order='C')
 
Construct Python bytes containing the raw data bytes in the array. Constructs Python bytes showing a copy of the raw contents of data memory. The bytes object is produced in C-order by default. This behavior is controlled by the order parameter.  New in version 1.9.0.   Parameters 
 
order{‘C’, ‘F’, ‘A’}, optional


Controls the memory layout of the bytes object. ‘C’ means C-order, ‘F’ means F-order, ‘A’ (short for Any) means ‘F’ if a is Fortran contiguous, ‘C’ otherwise. Default is ‘C’.    Returns 
 
sbytes


Python bytes exhibiting a copy of a’s raw data.     Examples >>> x = np.array([[0, 1], [2, 3]], dtype='<u2')
>>> x.tobytes()
b'\x00\x00\x01\x00\x02\x00\x03\x00'
>>> x.tobytes('C') == x.tobytes()
True
>>> x.tobytes('F')
b'\x00\x00\x02\x00\x01\x00\x03\x00'
numpy.recarray.tofile method   recarray.tofile(fid, sep='', format='%s')
 
Write array to a file as text or binary (default). Data is always written in ‘C’ order, independent of the order of a. The data produced by this method can be recovered using the function fromfile().  Parameters 
 
fidfile or str or Path


An open file object, or a string containing a filename.  Changed in version 1.17.0: pathlib.Path objects are now accepted.   
sepstr


Separator between array items for text output. If “” (empty), a binary file is written, equivalent to file.write(a.tobytes()).  
formatstr


Format string for text file output. Each entry in the array is formatted to text by first converting it to the closest Python type, and then using “format” % item.     Notes This is a convenience function for quick storage of array data. Information on endianness and precision is lost, so this method is not a good choice for files intended to archive data or transport data between machines with different endianness. Some of these problems can be overcome by outputting the data as text files, at the expense of speed and file size. When fid is a file object, array contents are directly written to the file, bypassing the file object’s write method. As a result, tofile cannot be used with files objects supporting compression (e.g., GzipFile) or file-like objects that do not support fileno() (e.g., BytesIO).
numpy.recarray.tolist method   recarray.tolist()
 
Return the array as an a.ndim-levels deep nested list of Python scalars. Return a copy of the array data as a (nested) Python list. Data items are converted to the nearest compatible builtin Python type, via the item function. If a.ndim is 0, then since the depth of the nested list is 0, it will not be a list at all, but a simple Python scalar.  Parameters 
 none
  Returns 
 
yobject, or list of object, or list of list of object, or …


The possibly nested list of array elements.     Notes The array may be recreated via a = np.array(a.tolist()), although this may sometimes lose precision. Examples For a 1D array, a.tolist() is almost the same as list(a), except that tolist changes numpy scalars to Python scalars: >>> a = np.uint32([1, 2])
>>> a_list = list(a)
>>> a_list
[1, 2]
>>> type(a_list[0])
<class 'numpy.uint32'>
>>> a_tolist = a.tolist()
>>> a_tolist
[1, 2]
>>> type(a_tolist[0])
<class 'int'>
 Additionally, for a 2D array, tolist applies recursively: >>> a = np.array([[1, 2], [3, 4]])
>>> list(a)
[array([1, 2]), array([3, 4])]
>>> a.tolist()
[[1, 2], [3, 4]]
 The base case for this recursion is a 0D array: >>> a = np.array(1)
>>> list(a)
Traceback (most recent call last):
  ...
TypeError: iteration over a 0-d array
>>> a.tolist()
1
numpy.recarray.tostring method   recarray.tostring(order='C')
 
A compatibility alias for tobytes, with exactly the same behavior. Despite its name, it returns bytes not strs.  Deprecated since version 1.19.0.
numpy.recarray.trace method   recarray.trace(offset=0, axis1=0, axis2=1, dtype=None, out=None)
 
Return the sum along diagonals of the array. Refer to numpy.trace for full documentation.  See also  numpy.trace

equivalent function
numpy.recarray.transpose method   recarray.transpose(*axes)
 
Returns a view of the array with axes transposed. For a 1-D array this has no effect, as a transposed vector is simply the same vector. To convert a 1-D array into a 2D column vector, an additional dimension must be added. np.atleast2d(a).T achieves this, as does a[:, np.newaxis]. For a 2-D array, this is a standard matrix transpose. For an n-D array, if axes are given, their order indicates how the axes are permuted (see Examples). If axes are not provided and a.shape = (i[0], i[1], ... i[n-2], i[n-1]), then a.transpose().shape = (i[n-1], i[n-2], ... i[1], i[0]).  Parameters 
 
axesNone, tuple of ints, or n ints


 None or no argument: reverses the order of the axes. tuple of ints: i in the j-th place in the tuple means a’s i-th axis becomes a.transpose()’s j-th axis. 
n ints: same as an n-tuple of the same ints (this form is intended simply as a “convenience” alternative to the tuple form)     Returns 
 
outndarray


View of a, with axes suitably permuted.      See also  transpose

Equivalent function  ndarray.T

Array property returning the array transposed.  ndarray.reshape

Give a new shape to an array without changing its data.    Examples >>> a = np.array([[1, 2], [3, 4]])
>>> a
array([[1, 2],
       [3, 4]])
>>> a.transpose()
array([[1, 3],
       [2, 4]])
>>> a.transpose((1, 0))
array([[1, 3],
       [2, 4]])
>>> a.transpose(1, 0)
array([[1, 3],
       [2, 4]])
numpy.recarray.var method   recarray.var(axis=None, dtype=None, out=None, ddof=0, keepdims=False, *, where=True)
 
Returns the variance of the array elements, along given axis. Refer to numpy.var for full documentation.  See also  numpy.var

equivalent function
numpy.recarray.view method   recarray.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.record.all method   record.all()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.all.
numpy.record.any method   record.any()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.any.
numpy.record.argmax method   record.argmax()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.argmax.
numpy.record.argmin method   record.argmin()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.argmin.
numpy.record.argsort method   record.argsort()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.argsort.
numpy.record.astype method   record.astype()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.astype.
numpy.record.byteswap method   record.byteswap()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.byteswap.
numpy.record.choose method   record.choose()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.choose.
numpy.record.clip method   record.clip()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.clip.
numpy.record.compress method   record.compress()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.compress.
numpy.record.conjugate method   record.conjugate()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.conjugate.
numpy.record.copy method   record.copy()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.copy.
numpy.record.cumprod method   record.cumprod()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.cumprod.
numpy.record.cumsum method   record.cumsum()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.cumsum.
numpy.record.diagonal method   record.diagonal()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.diagonal.
numpy.record.dump method   record.dump()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.dump.
numpy.record.dumps method   record.dumps()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.dumps.
numpy.record.fill method   record.fill()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.fill.
numpy.record.flat attribute   record.flat
 
A 1-D view of the scalar.
numpy.record.flatten method   record.flatten()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.flatten.
numpy.record.getfield method   record.getfield()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.getfield.
numpy.record.item method   record.item()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.item.
numpy.record.itemset method   record.itemset()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.itemset.
numpy.record.itemsize attribute   record.itemsize
 
The length of one element in bytes.
numpy.record.max method   record.max()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.max.
numpy.record.mean method   record.mean()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.mean.
numpy.record.min method   record.min()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.min.
numpy.record.nbytes attribute   record.nbytes
 
The length of the scalar in bytes.
numpy.record.ndim attribute   record.ndim
 
The number of array dimensions.
numpy.record.newbyteorder method   record.newbyteorder(new_order='S', /)
 
Return a new dtype with a different byte order. Changes are also made in all fields and sub-arrays of the data type. The new_order code can be any from the following:  ‘S’ - swap dtype from current to opposite endian {‘<’, ‘little’} - little endian {‘>’, ‘big’} - big endian {‘=’, ‘native’} - native order {‘|’, ‘I’} - ignore (no change to byte order)   Parameters 
 
new_orderstr, optional


Byte order to force; a value from the byte order specifications above. The default value (‘S’) results in swapping the current byte order.    Returns 
 
new_dtypedtype


New dtype object with the given change to the byte order.
numpy.record.nonzero method   record.nonzero()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.nonzero.
numpy.record.pprint method   record.pprint()[source]
 
Pretty-print all fields.
numpy.record.prod method   record.prod()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.prod.
numpy.record.ptp method   record.ptp()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.ptp.
numpy.record.put method   record.put()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.put.
numpy.record.ravel method   record.ravel()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.ravel.
numpy.record.repeat method   record.repeat()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.repeat.
numpy.record.reshape method   record.reshape()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.reshape.
numpy.record.resize method   record.resize()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.resize.
numpy.record.round method   record.round()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.round.
numpy.record.searchsorted method   record.searchsorted()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.searchsorted.
numpy.record.setfield method   record.setfield()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.setfield.
numpy.record.setflags method   record.setflags()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.setflags.
numpy.record.size attribute   record.size
 
The number of elements in the gentype.
numpy.record.sort method   record.sort()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.sort.
numpy.record.squeeze method   record.squeeze()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.squeeze.
numpy.record.std method   record.std()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.std.
numpy.record.strides attribute   record.strides
 
Tuple of bytes steps in each dimension.
numpy.record.sum method   record.sum()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.sum.
numpy.record.swapaxes method   record.swapaxes()
 
Scalar method identical to the corresponding array attribute. Please see ndarray.swapaxes.