neulab/docprompting-conala huggingface dataset:
numpy.ndarray.sort method   ndarray.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.ndarray.squeeze method   ndarray.squeeze(axis=None)
 
Remove axes of length one from a. Refer to numpy.squeeze for full documentation.  See also  numpy.squeeze

equivalent function
numpy.ndarray.std method   ndarray.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.ndarray.strides attribute   ndarray.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.ndarray.sum method   ndarray.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.ndarray.swapaxes method   ndarray.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.ndarray.T attribute   ndarray.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.ndarray.take method   ndarray.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.ndarray.tobytes method   ndarray.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.ndarray.tofile method   ndarray.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.ndarray.tolist method   ndarray.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.ndarray.tostring method   ndarray.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.ndarray.trace method   ndarray.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.ndarray.transpose method   ndarray.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.ndarray.var method   ndarray.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.ndarray.view method   ndarray.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.ndindex.ndincr method   ndindex.ndincr()[source]
 
Increment the multi-dimensional index by one. This method is for backward compatibility only: do not use.  Deprecated since version 1.20.0: This method has been advised against since numpy 1.8.0, but only started emitting DeprecationWarning as of this version.
numpy.nditer.close method   nditer.close()
 
Resolve all writeback semantics in writeable operands.  New in version 1.15.0.   See also  Modifying Array Values
numpy.nditer.copy method   nditer.copy()
 
Get a copy of the iterator in its current state. Examples >>> x = np.arange(10)
>>> y = x + 1
>>> it = np.nditer([x, y])
>>> next(it)
(array(0), array(1))
>>> it2 = it.copy()
>>> next(it2)
(array(1), array(2))
numpy.nditer.debug_print method   nditer.debug_print()
 
Print the current state of the nditer instance and debug info to stdout.
numpy.nditer.enable_external_loop method   nditer.enable_external_loop()
 
When the “external_loop” was not used during construction, but is desired, this modifies the iterator to behave as if the flag was specified.
numpy.nditer.iternext method   nditer.iternext()
 
Check whether iterations are left, and perform a single internal iteration without returning the result. Used in the C-style pattern do-while pattern. For an example, see nditer.  Returns 
 
iternextbool


Whether or not there are iterations left.
numpy.nditer.operands attribute   nditer.operands
 
operands[Slice] The array(s) to be iterated over. Valid only before the iterator is closed.
numpy.nditer.remove_axis method   nditer.remove_axis(i, /)
 
Removes axis i from the iterator. Requires that the flag “multi_index” be enabled.
numpy.nditer.remove_multi_index method   nditer.remove_multi_index()
 
When the “multi_index” flag was specified, this removes it, allowing the internal iteration structure to be optimized further.
numpy.nditer.reset method   nditer.reset()
 
Reset the iterator to its initial state.
numpy.number.__class_getitem__ method   number.__class_getitem__(item, /)
 
Return a parametrized wrapper around the number type.  New in version 1.22.   Returns 
 
aliastypes.GenericAlias


A parametrized number type.      See also  PEP 585

Type hinting generics in standard collections.    Notes This method is only available for python 3.9 and later. Examples >>> from typing import Any
>>> import numpy as np
 >>> np.signedinteger[Any]
numpy.signedinteger[typing.Any]
numpy.absolute   numpy.absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'absolute'>
 
Calculate the absolute value element-wise. np.abs is a shorthand for this function.  Parameters 
 
xarray_like


Input array.  
outndarray, None, or tuple of ndarray and None, optional


A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.  
wherearray_like, optional


This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.  **kwargs

For other keyword-only arguments, see the ufunc docs.    Returns 
 
absolutendarray


An ndarray containing the absolute value of each element in x. For complex input, a + ib, the absolute value is \(\sqrt{ a^2 + b^2 }\). This is a scalar if x is a scalar.     Examples >>> x = np.array([-1.2, 1.2])
>>> np.absolute(x)
array([ 1.2,  1.2])
>>> np.absolute(1.2 + 1j)
1.5620499351813308
 Plot the function over [-10, 10]: >>> import matplotlib.pyplot as plt
 >>> x = np.linspace(start=-10, stop=10, num=101)
>>> plt.plot(x, np.absolute(x))
>>> plt.show()
    Plot the function over the complex plane: >>> xx = x + 1j * x[:, np.newaxis]
>>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray')
>>> plt.show()
    The abs function can be used as a shorthand for np.absolute on ndarrays. >>> x = np.array([-1.2, 1.2])
>>> abs(x)
array([1.2, 1.2])
numpy.add   numpy.add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'add'>
 
Add arguments element-wise.  Parameters 
 
x1, x2array_like


The arrays to be added. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).  
outndarray, None, or tuple of ndarray and None, optional


A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.  
wherearray_like, optional


This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.  **kwargs

For other keyword-only arguments, see the ufunc docs.    Returns 
 
addndarray or scalar


The sum of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.     Notes Equivalent to x1 + x2 in terms of array broadcasting. Examples >>> np.add(1.0, 4.0)
5.0
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x2 = np.arange(3.0)
>>> np.add(x1, x2)
array([[  0.,   2.,   4.],
       [  3.,   5.,   7.],
       [  6.,   8.,  10.]])
 The + operator can be used as a shorthand for np.add on ndarrays. >>> x1 = np.arange(9.0).reshape((3, 3))
>>> x2 = np.arange(3.0)
>>> x1 + x2
array([[ 0.,  2.,  4.],
       [ 3.,  5.,  7.],
       [ 6.,  8., 10.]])
numpy.all   numpy.all(a, axis=None, out=None, keepdims=<no value>, *, where=<no value>)[source]
 
Test whether all array elements along a given axis evaluate to True.  Parameters 
 
aarray_like


Input array or object that can be converted to an array.  
axisNone or int or tuple of ints, optional


Axis or axes along which a logical AND reduction is performed. The default (axis=None) is to perform a logical AND over all the dimensions of the input array. axis may be negative, in which case it counts from the last to the first axis.  New in version 1.7.0.  If this is a tuple of ints, a reduction is performed on multiple axes, instead of a single axis or all the axes as before.  
outndarray, optional


Alternate output array in which to place the result. It must have the same shape as the expected output and its type is preserved (e.g., if dtype(out) is float, the result will consist of 0.0’s and 1.0’s). See Output type determination for more details.  
keepdimsbool, optional


If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. If the default value is passed, then keepdims will not be passed through to the all method of sub-classes of ndarray, however any non-default value will be. If the sub-class’ method does not implement keepdims any exceptions will be raised.  
wherearray_like of bool, optional


Elements to include in checking for all True values. See reduce for details.  New in version 1.20.0.     Returns 
 
allndarray, bool


A new boolean or array is returned unless out is specified, in which case a reference to out is returned.      See also  ndarray.all

equivalent method  any

Test whether any element along a given axis evaluates to True.    Notes Not a Number (NaN), positive infinity and negative infinity evaluate to True because these are not equal to zero. Examples >>> np.all([[True,False],[True,True]])
False
 >>> np.all([[True,False],[True,True]], axis=0)
array([ True, False])
 >>> np.all([-1, 4, 5])
True
 >>> np.all([1.0, np.nan])
True
 >>> np.all([[True, True], [False, True]], where=[[True], [False]])
True
 >>> o=np.array(False)
>>> z=np.all([-1, 4, 5], out=o)
>>> id(z), id(o), z
(28293632, 28293632, array(True)) # may vary
numpy.allclose   numpy.allclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False)[source]
 
Returns True if two arrays are element-wise equal within a tolerance. The tolerance values are positive, typically very small numbers. The relative difference (rtol * abs(b)) and the absolute difference atol are added together to compare against the absolute difference between a and b. NaNs are treated as equal if they are in the same place and if equal_nan=True. Infs are treated as equal if they are in the same place and of the same sign in both arrays.  Parameters 
 
a, barray_like


Input arrays to compare.  
rtolfloat


The relative tolerance parameter (see Notes).  
atolfloat


The absolute tolerance parameter (see Notes).  
equal_nanbool


Whether to compare NaN’s as equal. If True, NaN’s in a will be considered equal to NaN’s in b in the output array.  New in version 1.10.0.     Returns 
 
allclosebool


Returns True if the two arrays are equal within the given tolerance; False otherwise.      See also  
isclose, all, any, equal

  Notes If the following equation is element-wise True, then allclose returns True. absolute(a - b) <= (atol + rtol * absolute(b)) The above equation is not symmetric in a and b, so that allclose(a, b) might be different from allclose(b, a) in some rare cases. The comparison of a and b uses standard broadcasting, which means that a and b need not have the same shape in order for allclose(a, b) to evaluate to True. The same is true for equal but not array_equal. allclose is not defined for non-numeric data types. bool is considered a numeric data-type for this purpose. Examples >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8])
False
>>> np.allclose([1e10,1e-8], [1.00001e10,1e-9])
True
>>> np.allclose([1e10,1e-8], [1.0001e10,1e-9])
False
>>> np.allclose([1.0, np.nan], [1.0, np.nan])
False
>>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True)
True