neulab/docprompting-conala huggingface dataset:
numpy.around   numpy.around(a, decimals=0, out=None)[source]
 
Evenly round to the given number of decimals.  Parameters 
 
aarray_like


Input data.  
decimalsint, optional


Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point.  
outndarray, optional


Alternative output array in which to place the result. It must have the same shape as the expected output, but the type of the output values will be cast if necessary. See Output type determination for more details.    Returns 
 
rounded_arrayndarray


An array of the same type as a, containing the rounded values. Unless out was specified, a new array is created. A reference to the result is returned. The real and imaginary parts of complex numbers are rounded separately. The result of rounding a float is a float.      See also  ndarray.round

equivalent method  
ceil, fix, floor, rint, trunc

  Notes For values exactly halfway between rounded decimal values, NumPy rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -0.5 and 0.5 round to 0.0, etc. np.around uses a fast but sometimes inexact algorithm to round floating-point datatypes. For positive decimals it is equivalent to np.true_divide(np.rint(a * 10**decimals), 10**decimals), which has error due to the inexact representation of decimal fractions in the IEEE floating point standard [1] and errors introduced when scaling by powers of ten. For instance, note the extra “1” in the following: >>> np.round(56294995342131.5, 3)
56294995342131.51
 If your goal is to print such values with a fixed number of decimals, it is preferable to use numpy’s float printing routines to limit the number of printed decimals: >>> np.format_float_positional(56294995342131.5, precision=3)
'56294995342131.5'
 The float printing routines use an accurate but much more computationally demanding algorithm to compute the number of digits after the decimal point. Alternatively, Python’s builtin round function uses a more accurate but slower algorithm for 64-bit floating point values: >>> round(56294995342131.5, 3)
56294995342131.5
>>> np.round(16.055, 2), round(16.055, 2)  # equals 16.0549999999999997
(16.06, 16.05)
 References  1 
“Lecture Notes on the Status of IEEE 754”, William Kahan, https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF   Examples >>> np.around([0.37, 1.64])
array([0., 2.])
>>> np.around([0.37, 1.64], decimals=1)
array([0.4, 1.6])
>>> np.around([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value
array([0., 2., 2., 4., 4.])
>>> np.around([1,2,3,11], decimals=1) # ndarray of ints is returned
array([ 1,  2,  3, 11])
>>> np.around([1,2,3,11], decimals=-1)
array([ 0,  0,  0, 10])
numpy.array_equal   numpy.array_equal(a1, a2, equal_nan=False)[source]
 
True if two arrays have the same shape and elements, False otherwise.  Parameters 
 
a1, a2array_like


Input arrays.  
equal_nanbool


Whether to compare NaN’s as equal. If the dtype of a1 and a2 is complex, values will be considered equal if either the real or the imaginary component of a given value is nan.  New in version 1.19.0.     Returns 
 
bbool


Returns True if the arrays are equal.      See also  allclose

Returns True if two arrays are element-wise equal within a tolerance.  array_equiv

Returns True if input arrays are shape consistent and all elements equal.    Examples >>> np.array_equal([1, 2], [1, 2])
True
>>> np.array_equal(np.array([1, 2]), np.array([1, 2]))
True
>>> np.array_equal([1, 2], [1, 2, 3])
False
>>> np.array_equal([1, 2], [1, 4])
False
>>> a = np.array([1, np.nan])
>>> np.array_equal(a, a)
False
>>> np.array_equal(a, a, equal_nan=True)
True
 When equal_nan is True, complex values with nan components are considered equal if either the real or the imaginary components are nan. >>> a = np.array([1 + 1j])
>>> b = a.copy()
>>> a.real = np.nan
>>> b.imag = np.nan
>>> np.array_equal(a, b, equal_nan=True)
True
numpy.array_equiv   numpy.array_equiv(a1, a2)[source]
 
Returns True if input arrays are shape consistent and all elements equal. Shape consistent means they are either the same shape, or one input array can be broadcasted to create the same shape as the other one.  Parameters 
 
a1, a2array_like


Input arrays.    Returns 
 
outbool


True if equivalent, False otherwise.     Examples >>> np.array_equiv([1, 2], [1, 2])
True
>>> np.array_equiv([1, 2], [1, 3])
False
 Showing the shape equivalence: >>> np.array_equiv([1, 2], [[1, 2], [1, 2]])
True
>>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]])
False
 >>> np.array_equiv([1, 2], [[1, 2], [1, 3]])
False
numpy.array_repr   numpy.array_repr(arr, max_line_width=None, precision=None, suppress_small=None)[source]
 
Return the string representation of an array.  Parameters 
 
arrndarray


Input array.  
max_line_widthint, optional


Inserts newlines if text is longer than max_line_width. Defaults to numpy.get_printoptions()['linewidth'].  
precisionint, optional


Floating point precision. Defaults to numpy.get_printoptions()['precision'].  
suppress_smallbool, optional


Represent numbers “very close” to zero as zero; default is False. Very close is defined by precision: if the precision is 8, e.g., numbers smaller (in absolute value) than 5e-9 are represented as zero. Defaults to numpy.get_printoptions()['suppress'].    Returns 
 
stringstr


The string representation of an array.      See also  
array_str, array2string, set_printoptions

  Examples >>> np.array_repr(np.array([1,2]))
'array([1, 2])'
>>> np.array_repr(np.ma.array([0.]))
'MaskedArray([0.])'
>>> np.array_repr(np.array([], np.int32))
'array([], dtype=int32)'
 >>> x = np.array([1e-6, 4e-7, 2, 3])
>>> np.array_repr(x, precision=6, suppress_small=True)
'array([0.000001,  0.      ,  2.      ,  3.      ])'
numpy.array_split   numpy.array_split(ary, indices_or_sections, axis=0)[source]
 
Split an array into multiple sub-arrays. Please refer to the split documentation. The only difference between these functions is that array_split allows indices_or_sections to be an integer that does not equally divide the axis. For an array of length l that should be split into n sections, it returns l % n sub-arrays of size l//n + 1 and the rest of size l//n.  See also  split

Split array into multiple sub-arrays of equal size.    Examples >>> x = np.arange(8.0)
>>> np.array_split(x, 3)
[array([0.,  1.,  2.]), array([3.,  4.,  5.]), array([6.,  7.])]
 >>> x = np.arange(9)
>>> np.array_split(x, 4)
[array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])]
numpy.array_str   numpy.array_str(a, max_line_width=None, precision=None, suppress_small=None)[source]
 
Return a string representation of the data in an array. The data in the array is returned as a single string. This function is similar to array_repr, the difference being that array_repr also returns information on the kind of array and its data type.  Parameters 
 
andarray


Input array.  
max_line_widthint, optional


Inserts newlines if text is longer than max_line_width. Defaults to numpy.get_printoptions()['linewidth'].  
precisionint, optional


Floating point precision. Defaults to numpy.get_printoptions()['precision'].  
suppress_smallbool, optional


Represent numbers “very close” to zero as zero; default is False. Very close is defined by precision: if the precision is 8, e.g., numbers smaller (in absolute value) than 5e-9 are represented as zero. Defaults to numpy.get_printoptions()['suppress'].      See also  
array2string, array_repr, set_printoptions

  Examples >>> np.array_str(np.arange(3))
'[0 1 2]'
numpy.asanyarray   numpy.asanyarray(a, dtype=None, order=None, *, like=None)
 
Convert the input to an ndarray, but pass ndarray subclasses through.  Parameters 
 
aarray_like


Input data, in any form that can be converted to an array. This includes scalars, lists, lists of tuples, tuples, tuples of tuples, tuples of lists, and ndarrays.  
dtypedata-type, optional


By default, the data-type is inferred from the input data.  
order{‘C’, ‘F’, ‘A’, ‘K’}, optional


Memory layout. ‘A’ and ‘K’ depend on the order of input array a. ‘C’ row-major (C-style), ‘F’ column-major (Fortran-style) memory representation. ‘A’ (any) means ‘F’ if a is Fortran contiguous, ‘C’ otherwise ‘K’ (keep) preserve input order Defaults to ‘C’.  
likearray_like


Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.  New in version 1.20.0.     Returns 
 
outndarray or an ndarray subclass


Array interpretation of a. If a is an ndarray or a subclass of ndarray, it is returned as-is and no copy is performed.      See also  asarray

Similar function which always returns ndarrays.  ascontiguousarray

Convert input to a contiguous array.  asfarray

Convert input to a floating point ndarray.  asfortranarray

Convert input to an ndarray with column-major memory order.  asarray_chkfinite

Similar function which checks input for NaNs and Infs.  fromiter

Create an array from an iterator.  fromfunction

Construct an array by executing a function on grid positions.    Examples Convert a list into an array: >>> a = [1, 2]
>>> np.asanyarray(a)
array([1, 2])
 Instances of ndarray subclasses are passed through as-is: >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray)
>>> np.asanyarray(a) is a
True
numpy.asarray   numpy.asarray(a, dtype=None, order=None, *, like=None)
 
Convert the input to an array.  Parameters 
 
aarray_like


Input data, in any form that can be converted to an array. This includes lists, lists of tuples, tuples, tuples of tuples, tuples of lists and ndarrays.  
dtypedata-type, optional


By default, the data-type is inferred from the input data.  
order{‘C’, ‘F’, ‘A’, ‘K’}, optional


Memory layout. ‘A’ and ‘K’ depend on the order of input array a. ‘C’ row-major (C-style), ‘F’ column-major (Fortran-style) memory representation. ‘A’ (any) means ‘F’ if a is Fortran contiguous, ‘C’ otherwise ‘K’ (keep) preserve input order Defaults to ‘K’.  
likearray_like


Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.  New in version 1.20.0.     Returns 
 
outndarray


Array interpretation of a. No copy is performed if the input is already an ndarray with matching dtype and order. If a is a subclass of ndarray, a base class ndarray is returned.      See also  asanyarray

Similar function which passes through subclasses.  ascontiguousarray

Convert input to a contiguous array.  asfarray

Convert input to a floating point ndarray.  asfortranarray

Convert input to an ndarray with column-major memory order.  asarray_chkfinite

Similar function which checks input for NaNs and Infs.  fromiter

Create an array from an iterator.  fromfunction

Construct an array by executing a function on grid positions.    Examples Convert a list into an array: >>> a = [1, 2]
>>> np.asarray(a)
array([1, 2])
 Existing arrays are not copied: >>> a = np.array([1, 2])
>>> np.asarray(a) is a
True
 If dtype is set, array is copied only if dtype does not match: >>> a = np.array([1, 2], dtype=np.float32)
>>> np.asarray(a, dtype=np.float32) is a
True
>>> np.asarray(a, dtype=np.float64) is a
False
 Contrary to asanyarray, ndarray subclasses are not passed through: >>> issubclass(np.recarray, np.ndarray)
True
>>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray)
>>> np.asarray(a) is a
False
>>> np.asanyarray(a) is a
True
numpy.asarray_chkfinite   numpy.asarray_chkfinite(a, dtype=None, order=None)[source]
 
Convert the input to an array, checking for NaNs or Infs.  Parameters 
 
aarray_like


Input data, in any form that can be converted to an array. This includes lists, lists of tuples, tuples, tuples of tuples, tuples of lists and ndarrays. Success requires no NaNs or Infs.  
dtypedata-type, optional


By default, the data-type is inferred from the input data.  
order{‘C’, ‘F’, ‘A’, ‘K’}, optional


Memory layout. ‘A’ and ‘K’ depend on the order of input array a. ‘C’ row-major (C-style), ‘F’ column-major (Fortran-style) memory representation. ‘A’ (any) means ‘F’ if a is Fortran contiguous, ‘C’ otherwise ‘K’ (keep) preserve input order Defaults to ‘C’.    Returns 
 
outndarray


Array interpretation of a. No copy is performed if the input is already an ndarray. If a is a subclass of ndarray, a base class ndarray is returned.    Raises 
 ValueError

Raises ValueError if a contains NaN (Not a Number) or Inf (Infinity).      See also  asarray

Create and array.  asanyarray

Similar function which passes through subclasses.  ascontiguousarray

Convert input to a contiguous array.  asfarray

Convert input to a floating point ndarray.  asfortranarray

Convert input to an ndarray with column-major memory order.  fromiter

Create an array from an iterator.  fromfunction

Construct an array by executing a function on grid positions.    Examples Convert a list into an array. If all elements are finite asarray_chkfinite is identical to asarray. >>> a = [1, 2]
>>> np.asarray_chkfinite(a, dtype=float)
array([1., 2.])
 Raises ValueError if array_like contains Nans or Infs. >>> a = [1, 2, np.inf]
>>> try:
...     np.asarray_chkfinite(a)
... except ValueError:
...     print('ValueError')
...
ValueError
numpy.ascontiguousarray   numpy.ascontiguousarray(a, dtype=None, *, like=None)
 
Return a contiguous array (ndim >= 1) in memory (C order).  Parameters 
 
aarray_like


Input array.  
dtypestr or dtype object, optional


Data-type of returned array.  
likearray_like


Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.  New in version 1.20.0.     Returns 
 
outndarray


Contiguous array of same shape and content as a, with type dtype if specified.      See also  asfortranarray

Convert input to an ndarray with column-major memory order.  require

Return an ndarray that satisfies requirements.  ndarray.flags

Information about the memory layout of the array.    Examples >>> x = np.arange(6).reshape(2,3)
>>> np.ascontiguousarray(x, dtype=np.float32)
array([[0., 1., 2.],
       [3., 4., 5.]], dtype=float32)
>>> x.flags['C_CONTIGUOUS']
True
 Note: This function returns an array with at least one-dimension (1-d) so it will not preserve 0-d arrays.
numpy.asfarray   numpy.asfarray(a, dtype=<class 'numpy.double'>)[source]
 
Return an array converted to a float type.  Parameters 
 
aarray_like


The input array.  
dtypestr or dtype object, optional


Float type code to coerce input array a. If dtype is one of the ‘int’ dtypes, it is replaced with float64.    Returns 
 
outndarray


The input a as a float ndarray.     Examples >>> np.asfarray([2, 3])
array([2.,  3.])
>>> np.asfarray([2, 3], dtype='float')
array([2.,  3.])
>>> np.asfarray([2, 3], dtype='int8')
array([2.,  3.])
numpy.asfortranarray   numpy.asfortranarray(a, dtype=None, *, like=None)
 
Return an array (ndim >= 1) laid out in Fortran order in memory.  Parameters 
 
aarray_like


Input array.  
dtypestr or dtype object, optional


By default, the data-type is inferred from the input data.  
likearray_like


Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.  New in version 1.20.0.     Returns 
 
outndarray


The input a in Fortran, or column-major, order.      See also  ascontiguousarray

Convert input to a contiguous (C order) array.  asanyarray

Convert input to an ndarray with either row or column-major memory order.  require

Return an ndarray that satisfies requirements.  ndarray.flags

Information about the memory layout of the array.    Examples >>> x = np.arange(6).reshape(2,3)
>>> y = np.asfortranarray(x)
>>> x.flags['F_CONTIGUOUS']
False
>>> y.flags['F_CONTIGUOUS']
True
 Note: This function returns an array with at least one-dimension (1-d) so it will not preserve 0-d arrays.
numpy.asmatrix   numpy.asmatrix(data, dtype=None)[source]
 
Interpret the input as a matrix. Unlike matrix, asmatrix does not make a copy if the input is already a matrix or an ndarray. Equivalent to matrix(data, copy=False).  Parameters 
 
dataarray_like


Input data.  
dtypedata-type


Data-type of the output matrix.    Returns 
 
matmatrix


data interpreted as a matrix.     Examples >>> x = np.array([[1, 2], [3, 4]])
 >>> m = np.asmatrix(x)
 >>> x[0,0] = 5
 >>> m
matrix([[5, 2],
        [3, 4]])
numpy.asscalar   numpy.asscalar(a)[source]
 
Convert an array of size 1 to its scalar equivalent.  Deprecated since version 1.16: Deprecated, use numpy.ndarray.item() instead.   Parameters 
 
andarray


Input array of size 1.    Returns 
 
outscalar


Scalar representation of a. The output data type is the same type returned by the input’s item method.     Examples >>> np.asscalar(np.array([24]))
24
numpy.atleast_1d   numpy.atleast_1d(*arys)[source]
 
Convert inputs to arrays with at least one dimension. Scalar inputs are converted to 1-dimensional arrays, whilst higher-dimensional inputs are preserved.  Parameters 
 
arys1, arys2, …array_like


One or more input arrays.    Returns 
 
retndarray


An array, or list of arrays, each with a.ndim >= 1. Copies are made only if necessary.      See also  
atleast_2d, atleast_3d

  Examples >>> np.atleast_1d(1.0)
array([1.])
 >>> x = np.arange(9.0).reshape(3,3)
>>> np.atleast_1d(x)
array([[0., 1., 2.],
       [3., 4., 5.],
       [6., 7., 8.]])
>>> np.atleast_1d(x) is x
True
 >>> np.atleast_1d(1, [3, 4])
[array([1]), array([3, 4])]
numpy.atleast_2d   numpy.atleast_2d(*arys)[source]
 
View inputs as arrays with at least two dimensions.  Parameters 
 
arys1, arys2, …array_like


One or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have two or more dimensions are preserved.    Returns 
 
res, res2, …ndarray


An array, or list of arrays, each with a.ndim >= 2. Copies are avoided where possible, and views with two or more dimensions are returned.      See also  
atleast_1d, atleast_3d

  Examples >>> np.atleast_2d(3.0)
array([[3.]])
 >>> x = np.arange(3.0)
>>> np.atleast_2d(x)
array([[0., 1., 2.]])
>>> np.atleast_2d(x).base is x
True
 >>> np.atleast_2d(1, [1, 2], [[1, 2]])
[array([[1]]), array([[1, 2]]), array([[1, 2]])]
numpy.atleast_3d   numpy.atleast_3d(*arys)[source]
 
View inputs as arrays with at least three dimensions.  Parameters 
 
arys1, arys2, …array_like


One or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have three or more dimensions are preserved.    Returns 
 
res1, res2, …ndarray


An array, or list of arrays, each with a.ndim >= 3. Copies are avoided where possible, and views with three or more dimensions are returned. For example, a 1-D array of shape (N,) becomes a view of shape (1, N, 1), and a 2-D array of shape (M, N) becomes a view of shape (M, N, 1).      See also  
atleast_1d, atleast_2d

  Examples >>> np.atleast_3d(3.0)
array([[[3.]]])
 >>> x = np.arange(3.0)
>>> np.atleast_3d(x).shape
(1, 3, 1)
 >>> x = np.arange(12.0).reshape(4,3)
>>> np.atleast_3d(x).shape
(4, 3, 1)
>>> np.atleast_3d(x).base is x.base  # x is a reshape, so not base itself
True
 >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]):
...     print(arr, arr.shape) 
...
[[[1]
  [2]]] (1, 2, 1)
[[[1]
  [2]]] (1, 2, 1)
[[[1 2]]] (1, 1, 2)
numpy.average   numpy.average(a, axis=None, weights=None, returned=False)[source]
 
Compute the weighted average along the specified axis.  Parameters 
 
aarray_like


Array containing data to be averaged. If a is not an array, a conversion is attempted.  
axisNone or int or tuple of ints, optional


Axis or axes along which to average a. The default, axis=None, will average over all of the elements of the input array. If axis is negative it counts from the last to the first axis.  New in version 1.7.0.  If axis is a tuple of ints, averaging is performed on all of the axes specified in the tuple instead of a single axis or all the axes as before.  
weightsarray_like, optional


An array of weights associated with the values in a. Each value in a contributes to the average according to its associated weight. The weights array can either be 1-D (in which case its length must be the size of a along the given axis) or of the same shape as a. If weights=None, then all data in a are assumed to have a weight equal to one. The 1-D calculation is: avg = sum(a * weights) / sum(weights)
 The only constraint on weights is that sum(weights) must not be 0.  
returnedbool, optional


Default is False. If True, the tuple (average, sum_of_weights) is returned, otherwise only the average is returned. If weights=None, sum_of_weights is equivalent to the number of elements over which the average is taken.    Returns 
 
retval, [sum_of_weights]array_type or double


Return the average along the specified axis. When returned is True, return a tuple with the average as the first element and the sum of the weights as the second element. sum_of_weights is of the same type as retval. The result dtype follows a genereal pattern. If weights is None, the result dtype will be that of a , or float64 if a is integral. Otherwise, if weights is not None and a is non- integral, the result type will be the type of lowest precision capable of representing values of both a and weights. If a happens to be integral, the previous rules still applies but the result dtype will at least be float64.    Raises 
 ZeroDivisionError

When all weights along axis are zero. See numpy.ma.average for a version robust to this type of error.  TypeError

When the length of 1D weights is not the same as the shape of a along axis.      See also  mean
ma.average

average for masked arrays – useful if your data contains “missing” values  numpy.result_type

Returns the type that results from applying the numpy type promotion rules to the arguments.    Examples >>> data = np.arange(1, 5)
>>> data
array([1, 2, 3, 4])
>>> np.average(data)
2.5
>>> np.average(np.arange(1, 11), weights=np.arange(10, 0, -1))
4.0
 >>> data = np.arange(6).reshape((3,2))
>>> data
array([[0, 1],
       [2, 3],
       [4, 5]])
>>> np.average(data, axis=1, weights=[1./4, 3./4])
array([0.75, 2.75, 4.75])
>>> np.average(data, weights=[1./4, 3./4])
Traceback (most recent call last):
    ...
TypeError: Axis must be specified when shapes of a and weights differ.
 >>> a = np.ones(5, dtype=np.float128)
>>> w = np.ones(5, dtype=np.complex64)
>>> avg = np.average(a, weights=w)
>>> print(avg.dtype)
complex256