neulab/docprompting-conala huggingface dataset:
numpy.indices   numpy.indices(dimensions, dtype=<class 'int'>, sparse=False)[source]
 
Return an array representing the indices of a grid. Compute an array where the subarrays contain index values 0, 1, … varying only along the corresponding axis.  Parameters 
 
dimensionssequence of ints


The shape of the grid.  
dtypedtype, optional


Data type of the result.  
sparseboolean, optional


Return a sparse representation of the grid instead of a dense representation. Default is False.  New in version 1.17.     Returns 
 
gridone ndarray or tuple of ndarrays


 If sparse is False:

Returns one array of grid indices, grid.shape = (len(dimensions),) + tuple(dimensions).  If sparse is True:

Returns a tuple of arrays, with grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1) with dimensions[i] in the ith place        See also  
mgrid, ogrid, meshgrid

  Notes The output shape in the dense case is obtained by prepending the number of dimensions in front of the tuple of dimensions, i.e. if dimensions is a tuple (r0, ..., rN-1) of length N, the output shape is (N, r0, ..., rN-1). The subarrays grid[k] contains the N-D array of indices along the k-th axis. Explicitly: grid[k, i0, i1, ..., iN-1] = ik
 Examples >>> grid = np.indices((2, 3))
>>> grid.shape
(2, 2, 3)
>>> grid[0]        # row indices
array([[0, 0, 0],
       [1, 1, 1]])
>>> grid[1]        # column indices
array([[0, 1, 2],
       [0, 1, 2]])
 The indices can be used as an index into an array. >>> x = np.arange(20).reshape(5, 4)
>>> row, col = np.indices((2, 3))
>>> x[row, col]
array([[0, 1, 2],
       [4, 5, 6]])
 Note that it would be more straightforward in the above example to extract the required elements directly with x[:2, :3]. If sparse is set to true, the grid will be returned in a sparse representation. >>> i, j = np.indices((2, 3), sparse=True)
>>> i.shape
(2, 1)
>>> j.shape
(1, 3)
>>> i        # row indices
array([[0],
       [1]])
>>> j        # column indices
array([[0, 1, 2]])
numpy.inf
 
IEEE 754 floating point representation of (positive) infinity. Returns  yfloat


A floating point representation of positive infinity.   See Also isinf : Shows which elements are positive or negative infinity isposinf : Shows which elements are positive infinity isneginf : Shows which elements are negative infinity isnan : Shows which elements are Not a Number isfinite : Shows which elements are finite (not one of Not a Number, positive infinity and negative infinity) Notes NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic (IEEE 754). This means that Not a Number is not equivalent to infinity. Also that positive infinity is not equivalent to negative infinity. But infinity is equivalent to positive infinity. Inf, Infinity, PINF and infty are aliases for inf. Examples >>> np.inf
inf
>>> np.array([1]) / 0.
array([ Inf])
numpy.Infinity
 
IEEE 754 floating point representation of (positive) infinity. Use inf because Inf, Infinity, PINF and infty are aliases for inf. For more details, see inf. See Also inf
numpy.info   numpy.info(object=None, maxwidth=76, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, toplevel='numpy')[source]
 
Get help information for a function, class, or module.  Parameters 
 
objectobject or str, optional


Input object or name to get information about. If object is a numpy object, its docstring is given. If it is a string, available modules are searched for matching objects. If None, information about info itself is returned.  
maxwidthint, optional


Printing width.  
outputfile like object, optional


File like object that the output is written to, default is stdout. The object has to be opened in ‘w’ or ‘a’ mode.  
toplevelstr, optional


Start search at this level.      See also  
source, lookfor

  Notes When used interactively with an object, np.info(obj) is equivalent to help(obj) on the Python prompt or obj? on the IPython prompt. Examples >>> np.info(np.polyval) 
   polyval(p, x)
     Evaluate the polynomial p at x.
     ...
 When using a string for object it is possible to get multiple results. >>> np.info('fft') 
     *** Found in numpy ***
Core FFT routines
...
     *** Found in numpy.fft ***
 fft(a, n=None, axis=-1)
...
     *** Repeat reference found in numpy.fft.fftpack ***
     *** Total of 3 references found. ***
numpy.infty
 
IEEE 754 floating point representation of (positive) infinity. Use inf because Inf, Infinity, PINF and infty are aliases for inf. For more details, see inf. See Also inf
numpy.inner   numpy.inner(a, b, /)
 
Inner product of two arrays. Ordinary inner product of vectors for 1-D arrays (without complex conjugation), in higher dimensions a sum product over the last axes.  Parameters 
 
a, barray_like


If a and b are nonscalar, their last dimensions must match.    Returns 
 
outndarray


If a and b are both scalars or both 1-D arrays then a scalar is returned; otherwise an array is returned. out.shape = (*a.shape[:-1], *b.shape[:-1])    Raises 
 ValueError

If both a and b are nonscalar and their last dimensions have different sizes.      See also  tensordot

Sum products over arbitrary axes.  dot

Generalised matrix product, using second last dimension of b.  einsum

Einstein summation convention.    Notes For vectors (1-D arrays) it computes the ordinary inner-product: np.inner(a, b) = sum(a[:]*b[:])
 More generally, if ndim(a) = r > 0 and ndim(b) = s > 0: np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1))
 or explicitly: np.inner(a, b)[i0,...,ir-2,j0,...,js-2]
     = sum(a[i0,...,ir-2,:]*b[j0,...,js-2,:])
 In addition a or b may be scalars, in which case: np.inner(a,b) = a*b
 Examples Ordinary inner product for vectors: >>> a = np.array([1,2,3])
>>> b = np.array([0,1,0])
>>> np.inner(a, b)
2
 Some multidimensional examples: >>> a = np.arange(24).reshape((2,3,4))
>>> b = np.arange(4)
>>> c = np.inner(a, b)
>>> c.shape
(2, 3)
>>> c
array([[ 14,  38,  62],
       [ 86, 110, 134]])
 >>> a = np.arange(2).reshape((1,1,2))
>>> b = np.arange(6).reshape((3,2))
>>> c = np.inner(a, b)
>>> c.shape
(1, 1, 3)
>>> c
array([[[1, 3, 5]]])
 An example where b is a scalar: >>> np.inner(np.eye(2), 7)
array([[7., 0.],
       [0., 7.]])
numpy.insert   numpy.insert(arr, obj, values, axis=None)[source]
 
Insert values along the given axis before the given indices.  Parameters 
 
arrarray_like


Input array.  
objint, slice or sequence of ints


Object that defines the index or indices before which values is inserted.  New in version 1.8.0.  Support for multiple insertions when obj is a single scalar or a sequence with one element (similar to calling insert multiple times).  
valuesarray_like


Values to insert into arr. If the type of values is different from that of arr, values is converted to the type of arr. values should be shaped so that arr[...,obj,...] = values is legal.  
axisint, optional


Axis along which to insert values. If axis is None then arr is flattened first.    Returns 
 
outndarray


A copy of arr with values inserted. Note that insert does not occur in-place: a new array is returned. If axis is None, out is a flattened array.      See also  append

Append elements at the end of an array.  concatenate

Join a sequence of arrays along an existing axis.  delete

Delete elements from an array.    Notes Note that for higher dimensional inserts obj=0 behaves very different from obj=[0] just like arr[:,0,:] = values is different from arr[:,[0],:] = values. Examples >>> a = np.array([[1, 1], [2, 2], [3, 3]])
>>> a
array([[1, 1],
       [2, 2],
       [3, 3]])
>>> np.insert(a, 1, 5)
array([1, 5, 1, ..., 2, 3, 3])
>>> np.insert(a, 1, 5, axis=1)
array([[1, 5, 1],
       [2, 5, 2],
       [3, 5, 3]])
 Difference between sequence and scalars: >>> np.insert(a, [1], [[1],[2],[3]], axis=1)
array([[1, 1, 1],
       [2, 2, 2],
       [3, 3, 3]])
>>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1),
...                np.insert(a, [1], [[1],[2],[3]], axis=1))
True
 >>> b = a.flatten()
>>> b
array([1, 1, 2, 2, 3, 3])
>>> np.insert(b, [2, 2], [5, 6])
array([1, 1, 5, ..., 2, 3, 3])
 >>> np.insert(b, slice(2, 4), [5, 6])
array([1, 1, 5, ..., 2, 3, 3])
 >>> np.insert(b, [2, 2], [7.13, False]) # type casting
array([1, 1, 7, ..., 2, 3, 3])
 >>> x = np.arange(8).reshape(2, 4)
>>> idx = (1, 3)
>>> np.insert(x, idx, 999, axis=1)
array([[  0, 999,   1,   2, 999,   3],
       [  4, 999,   5,   6, 999,   7]])
numpy.int8[source]
  numpy.int16
  numpy.int32
  numpy.int64
 
Aliases for the signed integer types (one of numpy.byte, numpy.short, numpy.intc, numpy.int_ and numpy.longlong) with the specified number of bits. Compatible with the C99 int8_t, int16_t, int32_t, and int64_t, respectively.
class numpy.int_[source]
 
Signed integer type, compatible with Python int and C long.  Character code 
'l'  Alias on this platform (Linux x86_64) 
numpy.int64: 64-bit signed integer (-9_223_372_036_854_775_808 to 9_223_372_036_854_775_807).  Alias on this platform (Linux x86_64) 
numpy.intp: Signed integer large enough to fit pointer, compatible with C intptr_t.
class numpy.intc[source]
 
Signed integer type, compatible with C int.  Character code 
'i'  Alias on this platform (Linux x86_64) 
numpy.int32: 32-bit signed integer (-2_147_483_648 to 2_147_483_647).
numpy.interp   numpy.interp(x, xp, fp, left=None, right=None, period=None)[source]
 
One-dimensional linear interpolation for monotonically increasing sample points. Returns the one-dimensional piecewise linear interpolant to a function with given discrete data points (xp, fp), evaluated at x.  Parameters 
 
xarray_like


The x-coordinates at which to evaluate the interpolated values.  
xp1-D sequence of floats


The x-coordinates of the data points, must be increasing if argument period is not specified. Otherwise, xp is internally sorted after normalizing the periodic boundaries with xp = xp % period.  
fp1-D sequence of float or complex


The y-coordinates of the data points, same length as xp.  
leftoptional float or complex corresponding to fp


Value to return for x < xp[0], default is fp[0].  
rightoptional float or complex corresponding to fp


Value to return for x > xp[-1], default is fp[-1].  
periodNone or float, optional


A period for the x-coordinates. This parameter allows the proper interpolation of angular x-coordinates. Parameters left and right are ignored if period is specified.  New in version 1.10.0.     Returns 
 
yfloat or complex (corresponding to fp) or ndarray


The interpolated values, same shape as x.    Raises 
 ValueError

If xp and fp have different length If xp or fp are not 1-D sequences If period == 0      Warning The x-coordinate sequence is expected to be increasing, but this is not explicitly enforced. However, if the sequence xp is non-increasing, interpolation results are meaningless. Note that, since NaN is unsortable, xp also cannot contain NaNs. A simple check for xp being strictly increasing is: np.all(np.diff(xp) > 0)
   See also  scipy.interpolate
  Examples >>> xp = [1, 2, 3]
>>> fp = [3, 2, 0]
>>> np.interp(2.5, xp, fp)
1.0
>>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp)
array([3.  , 3.  , 2.5 , 0.56, 0.  ])
>>> UNDEF = -99.0
>>> np.interp(3.14, xp, fp, right=UNDEF)
-99.0
 Plot an interpolant to the sine function: >>> x = np.linspace(0, 2*np.pi, 10)
>>> y = np.sin(x)
>>> xvals = np.linspace(0, 2*np.pi, 50)
>>> yinterp = np.interp(xvals, x, y)
>>> import matplotlib.pyplot as plt
>>> plt.plot(x, y, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.plot(xvals, yinterp, '-x')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.show()
    Interpolation with periodic x-coordinates: >>> x = [-180, -170, -185, 185, -10, -5, 0, 365]
>>> xp = [190, -190, 350, -350]
>>> fp = [5, 10, 3, 4]
>>> np.interp(x, xp, fp, period=360)
array([7.5 , 5.  , 8.75, 6.25, 3.  , 3.25, 3.5 , 3.75])
 Complex interpolation: >>> x = [1.5, 4.0]
>>> xp = [2,3,5]
>>> fp = [1.0j, 0, 2+3j]
>>> np.interp(x, xp, fp)
array([0.+1.j , 1.+1.5j])
numpy.intersect1d   numpy.intersect1d(ar1, ar2, assume_unique=False, return_indices=False)[source]
 
Find the intersection of two arrays. Return the sorted, unique values that are in both of the input arrays.  Parameters 
 
ar1, ar2array_like


Input arrays. Will be flattened if not already 1D.  
assume_uniquebool


If True, the input arrays are both assumed to be unique, which can speed up the calculation. If True but ar1 or ar2 are not unique, incorrect results and out-of-bounds indices could result. Default is False.  
return_indicesbool


If True, the indices which correspond to the intersection of the two arrays are returned. The first instance of a value is used if there are multiple. Default is False.  New in version 1.15.0.     Returns 
 
intersect1dndarray


Sorted 1D array of common and unique elements.  
comm1ndarray


The indices of the first occurrences of the common values in ar1. Only provided if return_indices is True.  
comm2ndarray


The indices of the first occurrences of the common values in ar2. Only provided if return_indices is True.      See also  numpy.lib.arraysetops

Module with a number of other functions for performing set operations on arrays.    Examples >>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1])
array([1, 3])
 To intersect more than two arrays, use functools.reduce: >>> from functools import reduce
>>> reduce(np.intersect1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2]))
array([3])
 To return the indices of the values common to the input arrays along with the intersected values: >>> x = np.array([1, 1, 2, 3, 4])
>>> y = np.array([2, 1, 4, 6])
>>> xy, x_ind, y_ind = np.intersect1d(x, y, return_indices=True)
>>> x_ind, y_ind
(array([0, 2, 4]), array([1, 0, 2]))
>>> xy, x[x_ind], y[y_ind]
(array([1, 2, 4]), array([1, 2, 4]), array([1, 2, 4]))
numpy.intp[source]
 
Alias for the signed integer type (one of numpy.byte, numpy.short, numpy.intc, numpy.int_ and np.longlong) that is the same size as a pointer. Compatible with the C intptr_t.  Character code 
'p'
numpy.invert   numpy.invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'invert'>
 
Compute bit-wise inversion, or bit-wise NOT, element-wise. Computes the bit-wise NOT of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator ~. For signed integer inputs, the two’s complement is returned. In a two’s-complement system negative numbers are represented by the two’s complement of the absolute value. This is the most common method of representing signed integers on computers [1]. A N-bit two’s-complement system can represent every integer in the range \(-2^{N-1}\) to \(+2^{N-1}-1\).  Parameters 
 
xarray_like


Only integer and boolean types are handled.  
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 
 
outndarray or scalar


Result. This is a scalar if x is a scalar.      See also  
bitwise_and, bitwise_or, bitwise_xor

logical_not
binary_repr

Return the binary representation of the input number as a string.    Notes bitwise_not is an alias for invert: >>> np.bitwise_not is np.invert
True
 References  1 
Wikipedia, “Two’s complement”, https://en.wikipedia.org/wiki/Two’s_complement   Examples We’ve seen that 13 is represented by 00001101. The invert or bit-wise NOT of 13 is then: >>> x = np.invert(np.array(13, dtype=np.uint8))
>>> x
242
>>> np.binary_repr(x, width=8)
'11110010'
 The result depends on the bit-width: >>> x = np.invert(np.array(13, dtype=np.uint16))
>>> x
65522
>>> np.binary_repr(x, width=16)
'1111111111110010'
 When using signed integer types the result is the two’s complement of the result for the unsigned type: >>> np.invert(np.array([13], dtype=np.int8))
array([-14], dtype=int8)
>>> np.binary_repr(-14, width=8)
'11110010'
 Booleans are accepted as well: >>> np.invert(np.array([True, False]))
array([False,  True])
 The ~ operator can be used as a shorthand for np.invert on ndarrays. >>> x1 = np.array([True, False])
>>> ~x1
array([False,  True])
numpy.is_busday   numpy.is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None)
 
Calculates which of the given dates are valid days, and which are not.  New in version 1.7.0.   Parameters 
 
datesarray_like of datetime64[D]


The array of dates to process.  
weekmaskstr or array_like of bool, optional


A seven-element array indicating which of Monday through Sunday are valid days. May be specified as a length-seven list or array, like [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for weekdays, optionally separated by white space. Valid abbreviations are: Mon Tue Wed Thu Fri Sat Sun  
holidaysarray_like of datetime64[D], optional


An array of dates to consider as invalid dates. They may be specified in any order, and NaT (not-a-time) dates are ignored. This list is saved in a normalized form that is suited for fast calculations of valid days.  
busdaycalbusdaycalendar, optional


A busdaycalendar object which specifies the valid days. If this parameter is provided, neither weekmask nor holidays may be provided.  
outarray of bool, optional


If provided, this array is filled with the result.    Returns 
 
outarray of bool


An array with the same shape as dates, containing True for each valid day, and False for each invalid day.      See also  busdaycalendar

An object that specifies a custom set of valid days.  busday_offset

Applies an offset counted in valid days.  busday_count

Counts how many valid days are in a half-open date range.    Examples >>> # The weekdays are Friday, Saturday, and Monday
... np.is_busday(['2011-07-01', '2011-07-02', '2011-07-18'],
...                 holidays=['2011-07-01', '2011-07-04', '2011-07-17'])
array([False, False,  True])
numpy.isclose   numpy.isclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False)[source]
 
Returns a boolean array where 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.  Warning The default atol is not appropriate for comparing numbers that are much smaller than one (see Notes).   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.    Returns 
 
yarray_like


Returns a boolean array of where a and b are equal within the given tolerance. If both a and b are scalars, returns a single boolean value.      See also  allclose
math.isclose
  Notes  New in version 1.7.0.  For finite values, isclose uses the following equation to test whether two floating point values are equivalent. absolute(a - b) <= (atol + rtol * absolute(b)) Unlike the built-in math.isclose, the above equation is not symmetric in a and b – it assumes b is the reference value – so that isclose(a, b) might be different from isclose(b, a). Furthermore, the default value of atol is not zero, and is used to determine what small values should be considered close to zero. The default value is appropriate for expected values of order unity: if the expected values are significantly smaller than one, it can result in false positives. atol should be carefully selected for the use case at hand. A zero value for atol will result in False if either a or b is zero. isclose is not defined for non-numeric data types. bool is considered a numeric data-type for this purpose. Examples >>> np.isclose([1e10,1e-7], [1.00001e10,1e-8])
array([ True, False])
>>> np.isclose([1e10,1e-8], [1.00001e10,1e-9])
array([ True, True])
>>> np.isclose([1e10,1e-8], [1.0001e10,1e-9])
array([False,  True])
>>> np.isclose([1.0, np.nan], [1.0, np.nan])
array([ True, False])
>>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True)
array([ True, True])
>>> np.isclose([1e-8, 1e-7], [0.0, 0.0])
array([ True, False])
>>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0)
array([False, False])
>>> np.isclose([1e-10, 1e-10], [1e-20, 0.0])
array([ True,  True])
>>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0)
array([False,  True])
numpy.iscomplex   numpy.iscomplex(x)[source]
 
Returns a bool array, where True if input element is complex. What is tested is whether the input has a non-zero imaginary part, not if the input type is complex.  Parameters 
 
xarray_like


Input array.    Returns 
 
outndarray of bools


Output array.      See also  isreal
iscomplexobj

Return True if x is a complex type or an array of complex numbers.    Examples >>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j])
array([ True, False, False, False, False,  True])
numpy.iscomplexobj   numpy.iscomplexobj(x)[source]
 
Check for a complex type or an array of complex numbers. The type of the input is checked, not the value. Even if the input has an imaginary part equal to zero, iscomplexobj evaluates to True.  Parameters 
 
xany


The input can be of any type and shape.    Returns 
 
iscomplexobjbool


The return value, True if x is of a complex type or has at least one complex element.      See also  
isrealobj, iscomplex

  Examples >>> np.iscomplexobj(1)
False
>>> np.iscomplexobj(1+0j)
True
>>> np.iscomplexobj([3, 1+0j, True])
True
numpy.isfinite   numpy.isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'isfinite'>
 
Test element-wise for finiteness (not infinity and not Not a Number). The result is returned as a boolean array.  Parameters 
 
xarray_like


Input values.  
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 
 
yndarray, bool


True where x is not positive infinity, negative infinity, or NaN; false otherwise. This is a scalar if x is a scalar.      See also  
isinf, isneginf, isposinf, isnan

  Notes Not a Number, positive infinity and negative infinity are considered to be non-finite. NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic (IEEE 754). This means that Not a Number is not equivalent to infinity. Also that positive infinity is not equivalent to negative infinity. But infinity is equivalent to positive infinity. Errors result if the second argument is also supplied when x is a scalar input, or if first and second arguments have different shapes. Examples >>> np.isfinite(1)
True
>>> np.isfinite(0)
True
>>> np.isfinite(np.nan)
False
>>> np.isfinite(np.inf)
False
>>> np.isfinite(np.NINF)
False
>>> np.isfinite([np.log(-1.),1.,np.log(0)])
array([False,  True, False])
 >>> x = np.array([-np.inf, 0., np.inf])
>>> y = np.array([2, 2, 2])
>>> np.isfinite(x, y)
array([0, 1, 0])
>>> y
array([0, 1, 0])