neulab/docprompting-conala huggingface dataset:
numpy.left_shift   numpy.left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'left_shift'>
 
Shift the bits of an integer to the left. Bits are shifted to the left by appending x2 0s at the right of x1. Since the internal representation of numbers is in binary format, this operation is equivalent to multiplying x1 by 2**x2.  Parameters 
 
x1array_like of integer type


Input values.  
x2array_like of integer type


Number of zeros to append to x1. Has to be non-negative. 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 
 
outarray of integer type


Return x1 with bits shifted x2 times to the left. This is a scalar if both x1 and x2 are scalars.      See also  right_shift

Shift the bits of an integer to the right.  binary_repr

Return the binary representation of the input number as a string.    Examples >>> np.binary_repr(5)
'101'
>>> np.left_shift(5, 2)
20
>>> np.binary_repr(20)
'10100'
 >>> np.left_shift(5, [1,2,3])
array([10, 20, 40])
 Note that the dtype of the second argument may change the dtype of the result and can lead to unexpected results in some cases (see Casting Rules): >>> a = np.left_shift(np.uint8(255), 1) # Expect 254
>>> print(a, type(a)) # Unexpected result due to upcasting
510 <class 'numpy.int64'>
>>> b = np.left_shift(np.uint8(255), np.uint8(1))
>>> print(b, type(b))
254 <class 'numpy.uint8'>
 The << operator can be used as a shorthand for np.left_shift on ndarrays. >>> x1 = 5
>>> x2 = np.array([1, 2, 3])
>>> x1 << x2
array([10, 20, 40])
numpy.less   numpy.less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'less'>
 
Return the truth value of (x1 < x2) element-wise.  Parameters 
 
x1, x2array_like


Input arrays. 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 
 
outndarray or scalar


Output array, element-wise comparison of x1 and x2. Typically of type bool, unless dtype=object is passed. This is a scalar if both x1 and x2 are scalars.      See also  
greater, less_equal, greater_equal, equal, not_equal

  Examples >>> np.less([1, 2], [2, 2])
array([ True, False])
 The < operator can be used as a shorthand for np.less on ndarrays. >>> a = np.array([1, 2])
>>> b = np.array([2, 2])
>>> a < b
array([ True, False])
numpy.less_equal   numpy.less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'less_equal'>
 
Return the truth value of (x1 <= x2) element-wise.  Parameters 
 
x1, x2array_like


Input arrays. 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 
 
outndarray or scalar


Output array, element-wise comparison of x1 and x2. Typically of type bool, unless dtype=object is passed. This is a scalar if both x1 and x2 are scalars.      See also  
greater, less, greater_equal, equal, not_equal

  Examples >>> np.less_equal([4, 2, 1], [2, 2, 2])
array([False,  True,  True])
 The <= operator can be used as a shorthand for np.less_equal on ndarrays. >>> a = np.array([4, 2, 1])
>>> b = np.array([2, 2, 2])
>>> a <= b
array([False,  True,  True])
numpy.lexsort   numpy.lexsort(keys, axis=- 1)
 
Perform an indirect stable sort using a sequence of keys. Given multiple sorting keys, which can be interpreted as columns in a spreadsheet, lexsort returns an array of integer indices that describes the sort order by multiple columns. The last key in the sequence is used for the primary sort order, the second-to-last key for the secondary sort order, and so on. The keys argument must be a sequence of objects that can be converted to arrays of the same shape. If a 2D array is provided for the keys argument, its rows are interpreted as the sorting keys and sorting is according to the last row, second last row etc.  Parameters 
 
keys(k, N) array or tuple containing k (N,)-shaped sequences


The k different “columns” to be sorted. The last column (or row if keys is a 2D array) is the primary sort key.  
axisint, optional


Axis to be indirectly sorted. By default, sort over the last axis.    Returns 
 
indices(N,) ndarray of ints


Array of indices that sort the keys along the specified axis.      See also  argsort

Indirect sort.  ndarray.sort

In-place sort.  sort

Return a sorted copy of an array.    Examples Sort names: first by surname, then by name. >>> surnames =    ('Hertz',    'Galilei', 'Hertz')
>>> first_names = ('Heinrich', 'Galileo', 'Gustav')
>>> ind = np.lexsort((first_names, surnames))
>>> ind
array([1, 2, 0])
 >>> [surnames[i] + ", " + first_names[i] for i in ind]
['Galilei, Galileo', 'Hertz, Gustav', 'Hertz, Heinrich']
 Sort two columns of numbers: >>> a = [1,5,1,4,3,4,4] # First column
>>> b = [9,4,0,4,0,2,1] # Second column
>>> ind = np.lexsort((b,a)) # Sort by a, then by b
>>> ind
array([2, 0, 4, 6, 5, 3, 1])
 >>> [(a[i],b[i]) for i in ind]
[(1, 0), (1, 9), (3, 0), (4, 1), (4, 2), (4, 4), (5, 4)]
 Note that sorting is first according to the elements of a. Secondary sorting is according to the elements of b. A normal argsort would have yielded: >>> [(a[i],b[i]) for i in np.argsort(a)]
[(1, 9), (1, 0), (3, 0), (4, 4), (4, 2), (4, 1), (5, 4)]
 Structured arrays are sorted lexically by argsort: >>> x = np.array([(1,9), (5,4), (1,0), (4,4), (3,0), (4,2), (4,1)],
...              dtype=np.dtype([('x', int), ('y', int)]))
 >>> np.argsort(x) # or np.argsort(x, order=('x', 'y'))
array([2, 0, 4, 6, 5, 3, 1])
numpy.lib.arraysetops Set operations for arrays based on sorting.  Notes For floating point arrays, inaccurate results may appear due to usual round-off and floating point comparison issues. Speed could be gained in some operations by an implementation of numpy.sort, that can provide directly the permutation vectors, thus avoiding calls to numpy.argsort. Original author: Robert Cimrman
numpy.lib.Arrayterator   class numpy.lib.Arrayterator(var, buf_size=None)[source]
 
Buffered iterator for big arrays. Arrayterator creates a buffered iterator for reading big arrays in small contiguous blocks. The class is useful for objects stored in the file system. It allows iteration over the object without reading everything in memory; instead, small blocks are read and iterated over. Arrayterator can be used with any object that supports multidimensional slices. This includes NumPy arrays, but also variables from Scientific.IO.NetCDF or pynetcdf for example.  Parameters 
 
vararray_like


The object to iterate over.  
buf_sizeint, optional


The buffer size. If buf_size is supplied, the maximum amount of data that will be read into memory is buf_size elements. Default is None, which will read as many element as possible into memory.      See also  ndenumerate

Multidimensional array iterator.  flatiter

Flat array iterator.  memmap

Create a memory-map to an array stored in a binary file on disk.    Notes The algorithm works by first finding a “running dimension”, along which the blocks will be extracted. Given an array of dimensions (d1, d2, ..., dn), e.g. if buf_size is smaller than d1, the first dimension will be used. If, on the other hand, d1 < buf_size < d1*d2 the second dimension will be used, and so on. Blocks are extracted along this dimension, and when the last block is returned the process continues from the next dimension, until all elements have been read. Examples >>> a = np.arange(3 * 4 * 5 * 6).reshape(3, 4, 5, 6)
>>> a_itor = np.lib.Arrayterator(a, 2)
>>> a_itor.shape
(3, 4, 5, 6)
 Now we can iterate over a_itor, and it will return arrays of size two. Since buf_size was smaller than any dimension, the first dimension will be iterated over first: >>> for subarr in a_itor:
...     if not subarr.all():
...         print(subarr, subarr.shape) 
>>> # [[[[0 1]]]] (1, 1, 1, 2)
  Attributes 
 var
buf_size
start
stop
step
shape

The shape of the array to be iterated over.  flat

A 1-D flat iterator for Arrayterator objects.
numpy.lib.mixins.NDArrayOperatorsMixin   class numpy.lib.mixins.NDArrayOperatorsMixin[source]
 
Mixin defining all operator special methods using __array_ufunc__. This class implements the special methods for almost all of Python’s builtin operators defined in the operator module, including comparisons (==, >, etc.) and arithmetic (+, *, -, etc.), by deferring to the __array_ufunc__ method, which subclasses must implement. It is useful for writing classes that do not inherit from numpy.ndarray, but that should support arithmetic and numpy universal functions like arrays as described in A Mechanism for Overriding Ufuncs. As an trivial example, consider this implementation of an ArrayLike class that simply wraps a NumPy array and ensures that the result of any arithmetic operation is also an ArrayLike object: class ArrayLike(np.lib.mixins.NDArrayOperatorsMixin):
    def __init__(self, value):
        self.value = np.asarray(value)

    # One might also consider adding the built-in list type to this
    # list, to support operations like np.add(array_like, list)
    _HANDLED_TYPES = (np.ndarray, numbers.Number)

    def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
        out = kwargs.get('out', ())
        for x in inputs + out:
            # Only support operations with instances of _HANDLED_TYPES.
            # Use ArrayLike instead of type(self) for isinstance to
            # allow subclasses that don't override __array_ufunc__ to
            # handle ArrayLike objects.
            if not isinstance(x, self._HANDLED_TYPES + (ArrayLike,)):
                return NotImplemented

        # Defer to the implementation of the ufunc on unwrapped values.
        inputs = tuple(x.value if isinstance(x, ArrayLike) else x
                       for x in inputs)
        if out:
            kwargs['out'] = tuple(
                x.value if isinstance(x, ArrayLike) else x
                for x in out)
        result = getattr(ufunc, method)(*inputs, **kwargs)

        if type(result) is tuple:
            # multiple return values
            return tuple(type(self)(x) for x in result)
        elif method == 'at':
            # no return value
            return None
        else:
            # one return value
            return type(self)(result)

    def __repr__(self):
        return '%s(%r)' % (type(self).__name__, self.value)
 In interactions between ArrayLike objects and numbers or numpy arrays, the result is always another ArrayLike: >>> x = ArrayLike([1, 2, 3])
>>> x - 1
ArrayLike(array([0, 1, 2]))
>>> 1 - x
ArrayLike(array([ 0, -1, -2]))
>>> np.arange(3) - x
ArrayLike(array([-1, -1, -1]))
>>> x - np.arange(3)
ArrayLike(array([1, 1, 1]))
 Note that unlike numpy.ndarray, ArrayLike does not allow operations with arbitrary, unrecognized types. This ensures that interactions with ArrayLike preserve a well-defined casting hierarchy.  New in version 1.13.
numpy.lib.NumpyVersion   class numpy.lib.NumpyVersion(vstring)[source]
 
Parse and compare numpy version strings. NumPy has the following versioning scheme (numbers given are examples; they can be > 9 in principle):  Released version: ‘1.8.0’, ‘1.8.1’, etc. Alpha: ‘1.8.0a1’, ‘1.8.0a2’, etc. Beta: ‘1.8.0b1’, ‘1.8.0b2’, etc. Release candidates: ‘1.8.0rc1’, ‘1.8.0rc2’, etc. Development versions: ‘1.8.0.dev-f1234afa’ (git commit hash appended) 
 Development versions after a1: ‘1.8.0a1.dev-f1234afa’,

‘1.8.0b2.dev-f1234afa’, ‘1.8.1rc1.dev-f1234afa’, etc.    Development versions (no git hash available): ‘1.8.0.dev-Unknown’  Comparing needs to be done against a valid version string or other NumpyVersion instance. Note that all development versions of the same (pre-)release compare equal.  New in version 1.9.0.   Parameters 
 
vstringstr


NumPy version string (np.__version__).     Examples >>> from numpy.lib import NumpyVersion
>>> if NumpyVersion(np.__version__) < '1.7.0':
...     print('skip')
>>> # skip
 >>> NumpyVersion('1.7')  # raises ValueError, add ".0"
Traceback (most recent call last):
    ...
ValueError: Not a valid numpy version string
numpy.lib.recfunctions.apply_along_fields(func, arr)[source]
 
Apply function ‘func’ as a reduction across fields of a structured array. This is similar to apply_along_axis, but treats the fields of a structured array as an extra axis. The fields are all first cast to a common type following the type-promotion rules from numpy.result_type applied to the field’s dtypes.  Parameters 
 
funcfunction


Function to apply on the “field” dimension. This function must support an axis argument, like np.mean, np.sum, etc.  
arrndarray


Structured array for which to apply func.    Returns 
 
outndarray


Result of the recution operation     Examples >>> from numpy.lib import recfunctions as rfn
>>> b = np.array([(1, 2, 5), (4, 5, 7), (7, 8 ,11), (10, 11, 12)],
...              dtype=[('x', 'i4'), ('y', 'f4'), ('z', 'f8')])
>>> rfn.apply_along_fields(np.mean, b)
array([ 2.66666667,  5.33333333,  8.66666667, 11.        ])
>>> rfn.apply_along_fields(np.mean, b[['x', 'z']])
array([ 3. ,  5.5,  9. , 11. ])
numpy.lib.recfunctions.assign_fields_by_name(dst, src, zero_unassigned=True)[source]
 
Assigns values from one structured array to another by field name. Normally in numpy >= 1.14, assignment of one structured array to another copies fields “by position”, meaning that the first field from the src is copied to the first field of the dst, and so on, regardless of field name. This function instead copies “by field name”, such that fields in the dst are assigned from the identically named field in the src. This applies recursively for nested structures. This is how structure assignment worked in numpy >= 1.6 to <= 1.13.  Parameters 
 
dstndarray


srcndarray


The source and destination arrays during assignment.  
zero_unassignedbool, optional


If True, fields in the dst for which there was no matching field in the src are filled with the value 0 (zero). This was the behavior of numpy <= 1.13. If False, those fields are not modified.
numpy.lib.recfunctions.drop_fields(base, drop_names, usemask=True, asrecarray=False)[source]
 
Return a new array with fields in drop_names dropped. Nested fields are supported.  Changed in version 1.18.0: drop_fields returns an array with 0 fields if all fields are dropped, rather than returning None as it did previously.   Parameters 
 
basearray


Input array  
drop_namesstring or sequence


String or sequence of strings corresponding to the names of the fields to drop.  
usemask{False, True}, optional


Whether to return a masked array or not.  
asrecarraystring or sequence, optional


Whether to return a recarray or a mrecarray (asrecarray=True) or a plain ndarray or masked array with flexible dtype. The default is False.     Examples >>> from numpy.lib import recfunctions as rfn
>>> a = np.array([(1, (2, 3.0)), (4, (5, 6.0))],
...   dtype=[('a', np.int64), ('b', [('ba', np.double), ('bb', np.int64)])])
>>> rfn.drop_fields(a, 'a')
array([((2., 3),), ((5., 6),)],
      dtype=[('b', [('ba', '<f8'), ('bb', '<i8')])])
>>> rfn.drop_fields(a, 'ba')
array([(1, (3,)), (4, (6,))], dtype=[('a', '<i8'), ('b', [('bb', '<i8')])])
>>> rfn.drop_fields(a, ['ba', 'bb'])
array([(1,), (4,)], dtype=[('a', '<i8')])
numpy.lib.recfunctions.find_duplicates(a, key=None, ignoremask=True, return_index=False)[source]
 
Find the duplicates in a structured array along a given key  Parameters 
 
aarray-like


Input array  
key{string, None}, optional


Name of the fields along which to check the duplicates. If None, the search is performed by records  
ignoremask{True, False}, optional


Whether masked data should be discarded or considered as duplicates.  
return_index{False, True}, optional


Whether to return the indices of the duplicated values.     Examples >>> from numpy.lib import recfunctions as rfn
>>> ndtype = [('a', int)]
>>> a = np.ma.array([1, 1, 1, 2, 2, 3, 3],
...         mask=[0, 0, 1, 0, 0, 0, 1]).view(ndtype)
>>> rfn.find_duplicates(a, ignoremask=True, return_index=True)
(masked_array(data=[(1,), (1,), (2,), (2,)],
             mask=[(False,), (False,), (False,), (False,)],
       fill_value=(999999,),
            dtype=[('a', '<i8')]), array([0, 1, 3, 4]))
numpy.lib.recfunctions.flatten_descr(ndtype)[source]
 
Flatten a structured data-type description. Examples >>> from numpy.lib import recfunctions as rfn
>>> ndtype = np.dtype([('a', '<i4'), ('b', [('ba', '<f8'), ('bb', '<i4')])])
>>> rfn.flatten_descr(ndtype)
(('a', dtype('int32')), ('ba', dtype('float64')), ('bb', dtype('int32')))
numpy.lib.recfunctions.get_fieldstructure(adtype, lastname=None, parents=None)[source]
 
Returns a dictionary with fields indexing lists of their parent fields. This function is used to simplify access to fields nested in other fields.  Parameters 
 
adtypenp.dtype


Input datatype  
lastnameoptional


Last processed field name (used internally during recursion).  
parentsdictionary


Dictionary of parent fields (used interbally during recursion).     Examples >>> from numpy.lib import recfunctions as rfn
>>> ndtype =  np.dtype([('A', int),
...                     ('B', [('BA', int),
...                            ('BB', [('BBA', int), ('BBB', int)])])])
>>> rfn.get_fieldstructure(ndtype)
... # XXX: possible regression, order of BBA and BBB is swapped
{'A': [], 'B': [], 'BA': ['B'], 'BB': ['B'], 'BBA': ['B', 'BB'], 'BBB': ['B', 'BB']}
numpy.lib.recfunctions.get_names(adtype)[source]
 
Returns the field names of the input datatype as a tuple.  Parameters 
 
adtypedtype


Input datatype     Examples >>> from numpy.lib import recfunctions as rfn
>>> rfn.get_names(np.empty((1,), dtype=int))
Traceback (most recent call last):
    ...
AttributeError: 'numpy.ndarray' object has no attribute 'names'
 >>> rfn.get_names(np.empty((1,), dtype=[('A',int), ('B', float)]))
Traceback (most recent call last):
    ...
AttributeError: 'numpy.ndarray' object has no attribute 'names'
>>> adtype = np.dtype([('a', int), ('b', [('ba', int), ('bb', int)])])
>>> rfn.get_names(adtype)
('a', ('b', ('ba', 'bb')))
numpy.lib.recfunctions.get_names_flat(adtype)[source]
 
Returns the field names of the input datatype as a tuple. Nested structure are flattened beforehand.  Parameters 
 
adtypedtype


Input datatype     Examples >>> from numpy.lib import recfunctions as rfn
>>> rfn.get_names_flat(np.empty((1,), dtype=int)) is None
Traceback (most recent call last):
    ...
AttributeError: 'numpy.ndarray' object has no attribute 'names'
>>> rfn.get_names_flat(np.empty((1,), dtype=[('A',int), ('B', float)]))
Traceback (most recent call last):
    ...
AttributeError: 'numpy.ndarray' object has no attribute 'names'
>>> adtype = np.dtype([('a', int), ('b', [('ba', int), ('bb', int)])])
>>> rfn.get_names_flat(adtype)
('a', 'b', 'ba', 'bb')
numpy.lib.recfunctions.join_by(key, r1, r2, jointype='inner', r1postfix='1', r2postfix='2', defaults=None, usemask=True, asrecarray=False)[source]
 
Join arrays r1 and r2 on key key. The key should be either a string or a sequence of string corresponding to the fields used to join the array. An exception is raised if the key field cannot be found in the two input arrays. Neither r1 nor r2 should have any duplicates along key: the presence of duplicates will make the output quite unreliable. Note that duplicates are not looked for by the algorithm.  Parameters 
 
key{string, sequence}


A string or a sequence of strings corresponding to the fields used for comparison.  
r1, r2arrays


Structured arrays.  
jointype{‘inner’, ‘outer’, ‘leftouter’}, optional


If ‘inner’, returns the elements common to both r1 and r2. If ‘outer’, returns the common elements as well as the elements of r1 not in r2 and the elements of not in r2. If ‘leftouter’, returns the common elements and the elements of r1 not in r2.  
r1postfixstring, optional


String appended to the names of the fields of r1 that are present in r2 but absent of the key.  
r2postfixstring, optional


String appended to the names of the fields of r2 that are present in r1 but absent of the key.  
defaults{dictionary}, optional


Dictionary mapping field names to the corresponding default values.  
usemask{True, False}, optional


Whether to return a MaskedArray (or MaskedRecords is asrecarray==True) or a ndarray.  
asrecarray{False, True}, optional


Whether to return a recarray (or MaskedRecords if usemask==True) or just a flexible-type ndarray.     Notes  The output is sorted along the key. A temporary array is formed by dropping the fields not in the key for the two arrays and concatenating the result. This array is then sorted, and the common entries selected. The output is constructed by filling the fields with the selected entries. Matching is not preserved if there are some duplicates…