neulab/docprompting-conala huggingface dataset:
numpy.ma.MaskedArray.min method   ma.MaskedArray.min(axis=None, out=None, fill_value=None, keepdims=<no value>)[source]
 
Return the minimum along a given axis.  Parameters 
 
axis{None, int}, optional


Axis along which to operate. By default, axis is None and the flattened input is used.  
outarray_like, optional


Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output.  
fill_valuescalar or None, optional


Value used to fill in the masked values. If None, use the output of minimum_fill_value.  
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 array.    Returns 
 
aminarray_like


New array holding the result. If out was specified, out is returned.      See also  ma.minimum_fill_value

Returns the minimum filling value for a given datatype.
numpy.ma.MaskedArray.nbytes attribute   ma.MaskedArray.nbytes
 
Total bytes consumed by the elements of the array. Notes Does not include memory consumed by non-element attributes of the array object. Examples >>> x = np.zeros((3,5,2), dtype=np.complex128)
>>> x.nbytes
480
>>> np.prod(x.shape) * x.itemsize
480
numpy.ma.MaskedArray.ndim attribute   ma.MaskedArray.ndim
 
Number of array dimensions. Examples >>> x = np.array([1, 2, 3])
>>> x.ndim
1
>>> y = np.zeros((2, 3, 4))
>>> y.ndim
3
numpy.ma.MaskedArray.nonzero method   ma.MaskedArray.nonzero()[source]
 
Return the indices of unmasked elements that are not zero. Returns a tuple of arrays, one for each dimension, containing the indices of the non-zero elements in that dimension. The corresponding non-zero values can be obtained with: a[a.nonzero()]
 To group the indices by element, rather than dimension, use instead: np.transpose(a.nonzero())
 The result of this is always a 2d array, with a row for each non-zero element.  Parameters 
 None
  Returns 
 
tuple_of_arraystuple


Indices of elements that are non-zero.      See also  numpy.nonzero

Function operating on ndarrays.  flatnonzero

Return indices that are non-zero in the flattened version of the input array.  numpy.ndarray.nonzero

Equivalent ndarray method.  count_nonzero

Counts the number of non-zero elements in the input array.    Examples >>> import numpy.ma as ma
>>> x = ma.array(np.eye(3))
>>> x
masked_array(
  data=[[1., 0., 0.],
        [0., 1., 0.],
        [0., 0., 1.]],
  mask=False,
  fill_value=1e+20)
>>> x.nonzero()
(array([0, 1, 2]), array([0, 1, 2]))
 Masked elements are ignored. >>> x[1, 1] = ma.masked
>>> x
masked_array(
  data=[[1.0, 0.0, 0.0],
        [0.0, --, 0.0],
        [0.0, 0.0, 1.0]],
  mask=[[False, False, False],
        [False,  True, False],
        [False, False, False]],
  fill_value=1e+20)
>>> x.nonzero()
(array([0, 2]), array([0, 2]))
 Indices can also be grouped by element. >>> np.transpose(x.nonzero())
array([[0, 0],
       [2, 2]])
 A common use for nonzero is to find the indices of an array, where a condition is True. Given an array a, the condition a > 3 is a boolean array and since False is interpreted as 0, ma.nonzero(a > 3) yields the indices of the a where the condition is true. >>> a = ma.array([[1,2,3],[4,5,6],[7,8,9]])
>>> a > 3
masked_array(
  data=[[False, False, False],
        [ True,  True,  True],
        [ True,  True,  True]],
  mask=False,
  fill_value=True)
>>> ma.nonzero(a > 3)
(array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2]))
 The nonzero method of the condition array can also be called. >>> (a > 3).nonzero()
(array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2]))
numpy.ma.MaskedArray.prod method   ma.MaskedArray.prod(axis=None, dtype=None, out=None, keepdims=<no value>)[source]
 
Return the product of the array elements over the given axis. Masked elements are set to 1 internally for computation. Refer to numpy.prod for full documentation.  See also  numpy.ndarray.prod

corresponding function for ndarrays  numpy.prod

equivalent function    Notes Arithmetic is modular when using integer types, and no error is raised on overflow.
numpy.ma.MaskedArray.product method   ma.MaskedArray.product(axis=None, dtype=None, out=None, keepdims=<no value>)[source]
 
Return the product of the array elements over the given axis. Masked elements are set to 1 internally for computation. Refer to numpy.prod for full documentation.  See also  numpy.ndarray.prod

corresponding function for ndarrays  numpy.prod

equivalent function    Notes Arithmetic is modular when using integer types, and no error is raised on overflow.
numpy.ma.MaskedArray.ptp method   ma.MaskedArray.ptp(axis=None, out=None, fill_value=None, keepdims=False)[source]
 
Return (maximum - minimum) along the given dimension (i.e. peak-to-peak value).  Warning ptp preserves the data type of the array. This means the return value for an input of signed integers with n bits (e.g. np.int8, np.int16, etc) is also a signed integer with n bits. In that case, peak-to-peak values greater than 2**(n-1)-1 will be returned as negative values. An example with a work-around is shown below.   Parameters 
 
axis{None, int}, optional


Axis along which to find the peaks. If None (default) the flattened array is used.  
out{None, array_like}, optional


Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output but the type will be cast if necessary.  
fill_valuescalar or None, optional


Value used to fill in the masked values.  
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 array.    Returns 
 
ptpndarray.


A new array holding the result, unless out was specified, in which case a reference to out is returned.     Examples >>> x = np.ma.MaskedArray([[4, 9, 2, 10],
...                        [6, 9, 7, 12]])
 >>> x.ptp(axis=1)
masked_array(data=[8, 6],
             mask=False,
       fill_value=999999)
 >>> x.ptp(axis=0)
masked_array(data=[2, 0, 5, 2],
             mask=False,
       fill_value=999999)
 >>> x.ptp()
10
 This example shows that a negative value can be returned when the input is an array of signed integers. >>> y = np.ma.MaskedArray([[1, 127],
...                        [0, 127],
...                        [-1, 127],
...                        [-2, 127]], dtype=np.int8)
>>> y.ptp(axis=1)
masked_array(data=[ 126,  127, -128, -127],
             mask=False,
       fill_value=999999,
            dtype=int8)
 A work-around is to use the view() method to view the result as unsigned integers with the same bit width: >>> y.ptp(axis=1).view(np.uint8)
masked_array(data=[126, 127, 128, 129],
             mask=False,
       fill_value=999999,
            dtype=uint8)
numpy.ma.MaskedArray.put method   ma.MaskedArray.put(indices, values, mode='raise')[source]
 
Set storage-indexed locations to corresponding values. Sets self._data.flat[n] = values[n] for each n in indices. If values is shorter than indices then it will repeat. If values has some masked values, the initial mask is updated in consequence, else the corresponding values are unmasked.  Parameters 
 
indices1-D array_like


Target indices, interpreted as integers.  
valuesarray_like


Values to place in self._data copy at target indices.  
mode{‘raise’, ‘wrap’, ‘clip’}, optional


Specifies how out-of-bounds indices will behave. ‘raise’ : raise an error. ‘wrap’ : wrap around. ‘clip’ : clip to the range.     Notes values can be a scalar or length 1 array. Examples >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
>>> x
masked_array(
  data=[[1, --, 3],
        [--, 5, --],
        [7, --, 9]],
  mask=[[False,  True, False],
        [ True, False,  True],
        [False,  True, False]],
  fill_value=999999)
>>> x.put([0,4,8],[10,20,30])
>>> x
masked_array(
  data=[[10, --, 3],
        [--, 20, --],
        [7, --, 30]],
  mask=[[False,  True, False],
        [ True, False,  True],
        [False,  True, False]],
  fill_value=999999)
 >>> x.put(4,999)
>>> x
masked_array(
  data=[[10, --, 3],
        [--, 999, --],
        [7, --, 30]],
  mask=[[False,  True, False],
        [ True, False,  True],
        [False,  True, False]],
  fill_value=999999)
numpy.ma.MaskedArray.ravel method   ma.MaskedArray.ravel(order='C')[source]
 
Returns a 1D version of self, as a view.  Parameters 
 
order{‘C’, ‘F’, ‘A’, ‘K’}, optional


The elements of a are read using this index order. ‘C’ means to index the elements in C-like order, with the last axis index changing fastest, back to the first axis index changing slowest. ‘F’ means to index the elements in Fortran-like index order, with the first index changing fastest, and the last index changing slowest. Note that the ‘C’ and ‘F’ options take no account of the memory layout of the underlying array, and only refer to the order of axis indexing. ‘A’ means to read the elements in Fortran-like index order if m is Fortran contiguous in memory, C-like order otherwise. ‘K’ means to read the elements in the order they occur in memory, except for reversing the data when strides are negative. By default, ‘C’ index order is used.    Returns 
 MaskedArray

Output view is of shape (self.size,) (or (np.ma.product(self.shape),)).     Examples >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
>>> x
masked_array(
  data=[[1, --, 3],
        [--, 5, --],
        [7, --, 9]],
  mask=[[False,  True, False],
        [ True, False,  True],
        [False,  True, False]],
  fill_value=999999)
>>> x.ravel()
masked_array(data=[1, --, 3, --, 5, --, 7, --, 9],
             mask=[False,  True, False,  True, False,  True, False,  True,
                   False],
       fill_value=999999)
numpy.ma.MaskedArray.repeat method   ma.MaskedArray.repeat(repeats, axis=None)[source]
 
Repeat elements of an array. Refer to numpy.repeat for full documentation.  See also  numpy.repeat

equivalent function
numpy.ma.MaskedArray.reshape method   ma.MaskedArray.reshape(*s, **kwargs)[source]
 
Give a new shape to the array without changing its data. Returns a masked array containing the same data, but with a new shape. The result is a view on the original array; if this is not possible, a ValueError is raised.  Parameters 
 
shapeint or tuple of ints


The new shape should be compatible with the original shape. If an integer is supplied, then the result will be a 1-D array of that length.  
order{‘C’, ‘F’}, optional


Determines whether the array data should be viewed as in C (row-major) or FORTRAN (column-major) order.    Returns 
 
reshaped_arrayarray


A new view on the array.      See also  reshape

Equivalent function in the masked array module.  numpy.ndarray.reshape

Equivalent method on ndarray object.  numpy.reshape

Equivalent function in the NumPy module.    Notes The reshaping operation cannot guarantee that a copy will not be made, to modify the shape in place, use a.shape = s Examples >>> x = np.ma.array([[1,2],[3,4]], mask=[1,0,0,1])
>>> x
masked_array(
  data=[[--, 2],
        [3, --]],
  mask=[[ True, False],
        [False,  True]],
  fill_value=999999)
>>> x = x.reshape((4,1))
>>> x
masked_array(
  data=[[--],
        [2],
        [3],
        [--]],
  mask=[[ True],
        [False],
        [False],
        [ True]],
  fill_value=999999)
numpy.ma.MaskedArray.resize method   ma.MaskedArray.resize(newshape, refcheck=True, order=False)[source]
 
 Warning This method does nothing, except raise a ValueError exception. A masked array does not own its data and therefore cannot safely be resized in place. Use the numpy.ma.resize function instead.  This method is difficult to implement safely and may be deprecated in future releases of NumPy.
numpy.ma.MaskedArray.round method   ma.MaskedArray.round(decimals=0, out=None)[source]
 
Return each element rounded to the given number of decimals. Refer to numpy.around for full documentation.  See also  numpy.ndarray.round

corresponding function for ndarrays  numpy.around

equivalent function
numpy.ma.MaskedArray.searchsorted method   ma.MaskedArray.searchsorted(v, side='left', sorter=None)
 
Find indices where elements of v should be inserted in a to maintain order. For full documentation, see numpy.searchsorted  See also  numpy.searchsorted

equivalent function
numpy.ma.MaskedArray.set_fill_value method   ma.MaskedArray.set_fill_value(value=None)[source]
numpy.ma.MaskedArray.shrink_mask method   ma.MaskedArray.shrink_mask()[source]
 
Reduce a mask to nomask when possible.  Parameters 
 None
  Returns 
 None
   Examples >>> x = np.ma.array([[1,2 ], [3, 4]], mask=[0]*4)
>>> x.mask
array([[False, False],
       [False, False]])
>>> x.shrink_mask()
masked_array(
  data=[[1, 2],
        [3, 4]],
  mask=False,
  fill_value=999999)
>>> x.mask
False
numpy.ma.MaskedArray.size attribute   ma.MaskedArray.size
 
Number of elements in the array. Equal to np.prod(a.shape), i.e., the product of the array’s dimensions. Notes a.size returns a standard arbitrary precision Python integer. This may not be the case with other methods of obtaining the same value (like the suggested np.prod(a.shape), which returns an instance of np.int_), and may be relevant if the value is used further in calculations that may overflow a fixed size integer type. Examples >>> x = np.zeros((3, 5, 2), dtype=np.complex128)
>>> x.size
30
>>> np.prod(x.shape)
30
numpy.ma.MaskedArray.soften_mask method   ma.MaskedArray.soften_mask()[source]
 
Force the mask to soft. Whether the mask of a masked array is hard or soft is determined by its hardmask property. soften_mask sets hardmask to False.  See also  ma.MaskedArray.hardmask
numpy.ma.MaskedArray.sort method   ma.MaskedArray.sort(axis=- 1, kind=None, order=None, endwith=True, fill_value=None)[source]
 
Sort the array, in-place  Parameters 
 
aarray_like


Array to be sorted.  
axisint, optional


Axis along which to sort. If None, the array is flattened before sorting. The default is -1, which sorts along the last axis.  
kind{‘quicksort’, ‘mergesort’, ‘heapsort’, ‘stable’}, optional


The sorting algorithm used.  
orderlist, optional


When a is a structured array, this argument specifies which fields to compare first, second, and so on. This list does not need to include all of the fields.  
endwith{True, False}, optional


Whether missing values (if any) should be treated as the largest values (True) or the smallest values (False) When the array contains unmasked values sorting at the same extremes of the datatype, the ordering of these values and the masked values is undefined.  
fill_valuescalar or None, optional


Value used internally for the masked values. If fill_value is not None, it supersedes endwith.    Returns 
 
sorted_arrayndarray


Array of the same type and shape as a.      See also  numpy.ndarray.sort

Method to sort an array in-place.  argsort

Indirect sort.  lexsort

Indirect stable sort on multiple keys.  searchsorted

Find elements in a sorted array.    Notes See sort for notes on the different sorting algorithms. Examples >>> a = np.ma.array([1, 2, 5, 4, 3],mask=[0, 1, 0, 1, 0])
>>> # Default
>>> a.sort()
>>> a
masked_array(data=[1, 3, 5, --, --],
             mask=[False, False, False,  True,  True],
       fill_value=999999)
 >>> a = np.ma.array([1, 2, 5, 4, 3],mask=[0, 1, 0, 1, 0])
>>> # Put missing values in the front
>>> a.sort(endwith=False)
>>> a
masked_array(data=[--, --, 1, 3, 5],
             mask=[ True,  True, False, False, False],
       fill_value=999999)
 >>> a = np.ma.array([1, 2, 5, 4, 3],mask=[0, 1, 0, 1, 0])
>>> # fill_value takes over endwith
>>> a.sort(endwith=False, fill_value=3)
>>> a
masked_array(data=[1, --, --, 3, 5],
             mask=[False,  True,  True, False, False],
       fill_value=999999)
numpy.ma.MaskedArray.squeeze method   ma.MaskedArray.squeeze(axis=None)[source]
 
Remove axes of length one from a. Refer to numpy.squeeze for full documentation.  See also  numpy.squeeze

equivalent function
numpy.ma.MaskedArray.std method   ma.MaskedArray.std(axis=None, dtype=None, out=None, ddof=0, keepdims=<no value>)[source]
 
Returns the standard deviation of the array elements along given axis. Masked entries are ignored. Refer to numpy.std for full documentation.  See also  numpy.ndarray.std

corresponding function for ndarrays  numpy.std

Equivalent function
numpy.ma.MaskedArray.strides attribute   ma.MaskedArray.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.ma.MaskedArray.sum method   ma.MaskedArray.sum(axis=None, dtype=None, out=None, keepdims=<no value>)[source]
 
Return the sum of the array elements over the given axis. Masked elements are set to 0 internally. Refer to numpy.sum for full documentation.  See also  numpy.ndarray.sum

corresponding function for ndarrays  numpy.sum

equivalent function    Examples >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
>>> x
masked_array(
  data=[[1, --, 3],
        [--, 5, --],
        [7, --, 9]],
  mask=[[False,  True, False],
        [ True, False,  True],
        [False,  True, False]],
  fill_value=999999)
>>> x.sum()
25
>>> x.sum(axis=1)
masked_array(data=[4, 5, 16],
             mask=[False, False, False],
       fill_value=999999)
>>> x.sum(axis=0)
masked_array(data=[8, 5, 12],
             mask=[False, False, False],
       fill_value=999999)
>>> print(type(x.sum(axis=0, dtype=np.int64)[0]))
<class 'numpy.int64'>
numpy.ma.MaskedArray.swapaxes method   ma.MaskedArray.swapaxes(axis1, axis2)[source]
 
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.ma.MaskedArray.take method   ma.MaskedArray.take(indices, axis=None, out=None, mode='raise')[source]
numpy.ma.MaskedArray.tobytes method   ma.MaskedArray.tobytes(fill_value=None, order='C')[source]
 
Return the array data as a string containing the raw bytes in the array. The array is filled with a fill value before the string conversion.  New in version 1.9.0.   Parameters 
 
fill_valuescalar, optional


Value used to fill in the masked values. Default is None, in which case MaskedArray.fill_value is used.  
order{‘C’,’F’,’A’}, optional


Order of the data item in the copy. Default is ‘C’.  ‘C’ – C order (row major). ‘F’ – Fortran order (column major). ‘A’ – Any, current order of array. None – Same as ‘A’.       See also  numpy.ndarray.tobytes

tolist, tofile

  Notes As for ndarray.tobytes, information about the shape, dtype, etc., but also about fill_value, will be lost. Examples >>> x = np.ma.array(np.array([[1, 2], [3, 4]]), mask=[[0, 1], [1, 0]])
>>> x.tobytes()
b'\x01\x00\x00\x00\x00\x00\x00\x00?B\x0f\x00\x00\x00\x00\x00?B\x0f\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00'
numpy.ma.MaskedArray.tofile method   ma.MaskedArray.tofile(fid, sep='', format='%s')[source]
 
Save a masked array to a file in binary format.  Warning This function is not implemented yet.   Raises 
 NotImplementedError

When tofile is called.
numpy.ma.MaskedArray.toflex method   ma.MaskedArray.toflex()[source]
 
Transforms a masked array into a flexible-type array. The flexible type array that is returned will have two fields:  the _data field stores the _data part of the array. the _mask field stores the _mask part of the array.   Parameters 
 None
  Returns 
 
recordndarray


A new flexible-type ndarray with two fields: the first element containing a value, the second element containing the corresponding mask boolean. The returned record shape matches self.shape.     Notes A side-effect of transforming a masked array into a flexible ndarray is that meta information (fill_value, …) will be lost. Examples >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
>>> x
masked_array(
  data=[[1, --, 3],
        [--, 5, --],
        [7, --, 9]],
  mask=[[False,  True, False],
        [ True, False,  True],
        [False,  True, False]],
  fill_value=999999)
>>> x.toflex()
array([[(1, False), (2,  True), (3, False)],
       [(4,  True), (5, False), (6,  True)],
       [(7, False), (8,  True), (9, False)]],
      dtype=[('_data', '<i8'), ('_mask', '?')])
numpy.ma.MaskedArray.tolist method   ma.MaskedArray.tolist(fill_value=None)[source]
 
Return the data portion of the masked array as a hierarchical Python list. Data items are converted to the nearest compatible Python type. Masked values are converted to fill_value. If fill_value is None, the corresponding entries in the output list will be None.  Parameters 
 
fill_valuescalar, optional


The value to use for invalid entries. Default is None.    Returns 
 
resultlist


The Python list representation of the masked array.     Examples >>> x = np.ma.array([[1,2,3], [4,5,6], [7,8,9]], mask=[0] + [1,0]*4)
>>> x.tolist()
[[1, None, 3], [None, 5, None], [7, None, 9]]
>>> x.tolist(-999)
[[1, -999, 3], [-999, 5, -999], [7, -999, 9]]
numpy.ma.MaskedArray.torecords method   ma.MaskedArray.torecords()[source]
 
Transforms a masked array into a flexible-type array. The flexible type array that is returned will have two fields:  the _data field stores the _data part of the array. the _mask field stores the _mask part of the array.   Parameters 
 None
  Returns 
 
recordndarray


A new flexible-type ndarray with two fields: the first element containing a value, the second element containing the corresponding mask boolean. The returned record shape matches self.shape.     Notes A side-effect of transforming a masked array into a flexible ndarray is that meta information (fill_value, …) will be lost. Examples >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
>>> x
masked_array(
  data=[[1, --, 3],
        [--, 5, --],
        [7, --, 9]],
  mask=[[False,  True, False],
        [ True, False,  True],
        [False,  True, False]],
  fill_value=999999)
>>> x.toflex()
array([[(1, False), (2,  True), (3, False)],
       [(4,  True), (5, False), (6,  True)],
       [(7, False), (8,  True), (9, False)]],
      dtype=[('_data', '<i8'), ('_mask', '?')])
numpy.ma.MaskedArray.tostring method   ma.MaskedArray.tostring(fill_value=None, order='C')[source]
 
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.ma.MaskedArray.trace method   ma.MaskedArray.trace(offset=0, axis1=0, axis2=1, dtype=None, out=None)[source]
 
Return the sum along diagonals of the array. Refer to numpy.trace for full documentation.  See also  numpy.trace

equivalent function