neulab/docprompting-conala huggingface dataset:
numpy.ma.MaskedArray.argsort method   ma.MaskedArray.argsort(axis=<no value>, kind=None, order=None, endwith=True, fill_value=None)[source]
 
Return an ndarray of indices that sort the array along the specified axis. Masked values are filled beforehand to fill_value.  Parameters 
 
axisint, optional


Axis along which to sort. If None, the default, the flattened array is used.  Changed in version 1.13.0: Previously, the default was documented to be -1, but that was in error. At some future date, the default will change to -1, as originally intended. Until then, the axis should be given explicitly when arr.ndim > 1, to avoid a FutureWarning.   
kind{‘quicksort’, ‘mergesort’, ‘heapsort’, ‘stable’}, optional


The sorting algorithm used.  
orderlist, optional


When a is an array with fields defined, this argument specifies which fields to compare first, second, etc. Not all fields need be specified.  
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 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 
 
index_arrayndarray, int


Array of indices that sort a along the specified axis. In other words, a[index_array] yields a sorted a.      See also  ma.MaskedArray.sort

Describes sorting algorithms used.  lexsort

Indirect stable sort with multiple keys.  numpy.ndarray.sort

Inplace sort.    Notes See sort for notes on the different sorting algorithms. Examples >>> a = np.ma.array([3,2,1], mask=[False, False, True])
>>> a
masked_array(data=[3, 2, --],
             mask=[False, False,  True],
       fill_value=999999)
>>> a.argsort()
array([1, 0, 2])
numpy.ma.MaskedArray.astype method   ma.MaskedArray.astype(dtype, order='K', casting='unsafe', subok=True, copy=True)
 
Copy of the array, cast to a specified type.  Parameters 
 
dtypestr or dtype


Typecode or data-type to which the array is cast.  
order{‘C’, ‘F’, ‘A’, ‘K’}, optional


Controls the memory layout order of the result. ‘C’ means C order, ‘F’ means Fortran order, ‘A’ means ‘F’ order if all the arrays are Fortran contiguous, ‘C’ order otherwise, and ‘K’ means as close to the order the array elements appear in memory as possible. Default is ‘K’.  
casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optional


Controls what kind of data casting may occur. Defaults to ‘unsafe’ for backwards compatibility.  ‘no’ means the data types should not be cast at all. ‘equiv’ means only byte-order changes are allowed. ‘safe’ means only casts which can preserve values are allowed. ‘same_kind’ means only safe casts or casts within a kind, like float64 to float32, are allowed. ‘unsafe’ means any data conversions may be done.   
subokbool, optional


If True, then sub-classes will be passed-through (default), otherwise the returned array will be forced to be a base-class array.  
copybool, optional


By default, astype always returns a newly allocated array. If this is set to false, and the dtype, order, and subok requirements are satisfied, the input array is returned instead of a copy.    Returns 
 
arr_tndarray


Unless copy is False and the other conditions for returning the input array are satisfied (see description for copy input parameter), arr_t is a new array of the same shape as the input array, with dtype, order given by dtype, order.    Raises 
 ComplexWarning

When casting from complex to float or int. To avoid this, one should use a.real.astype(t).     Notes  Changed in version 1.17.0: Casting between a simple data type and a structured one is possible only for “unsafe” casting. Casting to multiple fields is allowed, but casting from multiple fields is not.   Changed in version 1.9.0: Casting from numeric to string types in ‘safe’ casting mode requires that the string dtype length is long enough to store the max integer/float value converted.  Examples >>> x = np.array([1, 2, 2.5])
>>> x
array([1. ,  2. ,  2.5])
 >>> x.astype(int)
array([1, 2, 2])
numpy.ma.MaskedArray.base attribute   ma.MaskedArray.base
 
Base object if memory is from some other object. Examples The base of an array that owns its memory is None: >>> x = np.array([1,2,3,4])
>>> x.base is None
True
 Slicing creates a view, whose memory is shared with x: >>> y = x[2:]
>>> y.base is x
True
numpy.ma.MaskedArray.byteswap method   ma.MaskedArray.byteswap(inplace=False)
 
Swap the bytes of the array elements Toggle between low-endian and big-endian data representation by returning a byteswapped array, optionally swapped in-place. Arrays of byte-strings are not swapped. The real and imaginary parts of a complex number are swapped individually.  Parameters 
 
inplacebool, optional


If True, swap bytes in-place, default is False.    Returns 
 
outndarray


The byteswapped array. If inplace is True, this is a view to self.     Examples >>> A = np.array([1, 256, 8755], dtype=np.int16)
>>> list(map(hex, A))
['0x1', '0x100', '0x2233']
>>> A.byteswap(inplace=True)
array([  256,     1, 13090], dtype=int16)
>>> list(map(hex, A))
['0x100', '0x1', '0x3322']
 Arrays of byte-strings are not swapped >>> A = np.array([b'ceg', b'fac'])
>>> A.byteswap()
array([b'ceg', b'fac'], dtype='|S3')
  
A.newbyteorder().byteswap() produces an array with the same values

but different representation in memory   >>> A = np.array([1, 2, 3])
>>> A.view(np.uint8)
array([1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
       0, 0], dtype=uint8)
>>> A.newbyteorder().byteswap(inplace=True)
array([1, 2, 3])
>>> A.view(np.uint8)
array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
       0, 3], dtype=uint8)
numpy.ma.MaskedArray.choose method   ma.MaskedArray.choose(choices, out=None, mode='raise')
 
Use an index array to construct a new array from a set of choices. Refer to numpy.choose for full documentation.  See also  numpy.choose

equivalent function
numpy.ma.MaskedArray.clip method   ma.MaskedArray.clip(min=None, max=None, out=None, **kwargs)
 
Return an array whose values are limited to [min, max]. One of max or min must be given. Refer to numpy.clip for full documentation.  See also  numpy.clip

equivalent function
numpy.ma.MaskedArray.compress method   ma.MaskedArray.compress(condition, axis=None, out=None)[source]
 
Return a where condition is True. If condition is a MaskedArray, missing values are considered as False.  Parameters 
 
conditionvar


Boolean 1-d array selecting which entries to return. If len(condition) is less than the size of a along the axis, then output is truncated to length of condition array.  
axis{None, int}, optional


Axis along which the operation must be performed.  
out{None, ndarray}, optional


Alternative output array in which to place the result. It must have the same shape as the expected output but the type will be cast if necessary.    Returns 
 
resultMaskedArray


A MaskedArray object.     Notes Please note the difference with compressed ! The output of compress has a mask, the output of compressed does not. 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.compress([1, 0, 1])
masked_array(data=[1, 3],
             mask=[False, False],
       fill_value=999999)
 >>> x.compress([1, 0, 1], axis=1)
masked_array(
  data=[[1, 3],
        [--, --],
        [7, 9]],
  mask=[[False, False],
        [ True,  True],
        [False, False]],
  fill_value=999999)
numpy.ma.MaskedArray.compressed method   ma.MaskedArray.compressed()[source]
 
Return all the non-masked data as a 1-D array.  Returns 
 
datandarray


A new ndarray holding the non-masked data is returned.     Notes The result is not a MaskedArray! Examples >>> x = np.ma.array(np.arange(5), mask=[0]*2 + [1]*3)
>>> x.compressed()
array([0, 1])
>>> type(x.compressed())
<class 'numpy.ndarray'>
numpy.ma.MaskedArray.conj method   ma.MaskedArray.conj()
 
Complex-conjugate all elements. Refer to numpy.conjugate for full documentation.  See also  numpy.conjugate

equivalent function
numpy.ma.MaskedArray.conjugate method   ma.MaskedArray.conjugate()
 
Return the complex conjugate, element-wise. Refer to numpy.conjugate for full documentation.  See also  numpy.conjugate

equivalent function
numpy.ma.MaskedArray.copy method   ma.MaskedArray.copy(order='C')[source]
 
Return a copy of the array.  Parameters 
 
order{‘C’, ‘F’, ‘A’, ‘K’}, optional


Controls the memory layout of the copy. ‘C’ means C-order, ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of a as closely as possible. (Note that this function and numpy.copy are very similar but have different default values for their order= arguments, and this function always passes sub-classes through.)      See also  numpy.copy

Similar function with different default behavior  numpy.copyto
  Notes This function is the preferred method for creating an array copy. The function numpy.copy is similar, but it defaults to using order ‘K’, and will not pass sub-classes through by default. Examples >>> x = np.array([[1,2,3],[4,5,6]], order='F')
 >>> y = x.copy()
 >>> x.fill(0)
 >>> x
array([[0, 0, 0],
       [0, 0, 0]])
 >>> y
array([[1, 2, 3],
       [4, 5, 6]])
 >>> y.flags['C_CONTIGUOUS']
True
numpy.ma.MaskedArray.count method   ma.MaskedArray.count(axis=None, keepdims=<no value>)[source]
 
Count the non-masked elements of the array along the given axis.  Parameters 
 
axisNone or int or tuple of ints, optional


Axis or axes along which the count is performed. The default, None, performs the count over all the dimensions of the input array. axis may be negative, in which case it counts from the last to the first axis.  New in version 1.10.0.  If this is a tuple of ints, the count is performed on multiple axes, instead of a single axis or all the axes as before.  
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 
 
resultndarray or scalar


An array with the same shape as the input array, with the specified axis removed. If the array is a 0-d array, or if axis is None, a scalar is returned.      See also  ma.count_masked

Count masked elements in array or along a given axis.    Examples >>> import numpy.ma as ma
>>> a = ma.arange(6).reshape((2, 3))
>>> a[1, :] = ma.masked
>>> a
masked_array(
  data=[[0, 1, 2],
        [--, --, --]],
  mask=[[False, False, False],
        [ True,  True,  True]],
  fill_value=999999)
>>> a.count()
3
 When the axis keyword is specified an array of appropriate size is returned. >>> a.count(axis=0)
array([1, 1, 1])
>>> a.count(axis=1)
array([3, 0])
numpy.ma.MaskedArray.cumprod method   ma.MaskedArray.cumprod(axis=None, dtype=None, out=None)[source]
 
Return the cumulative product of the array elements over the given axis. Masked values are set to 1 internally during the computation. However, their position is saved, and the result will be masked at the same locations. Refer to numpy.cumprod for full documentation.  See also  numpy.ndarray.cumprod

corresponding function for ndarrays  numpy.cumprod

equivalent function    Notes The mask is lost if out is not a valid MaskedArray ! Arithmetic is modular when using integer types, and no error is raised on overflow.
numpy.ma.MaskedArray.cumsum method   ma.MaskedArray.cumsum(axis=None, dtype=None, out=None)[source]
 
Return the cumulative sum of the array elements over the given axis. Masked values are set to 0 internally during the computation. However, their position is saved, and the result will be masked at the same locations. Refer to numpy.cumsum for full documentation.  See also  numpy.ndarray.cumsum

corresponding function for ndarrays  numpy.cumsum

equivalent function    Notes The mask is lost if out is not a valid ma.MaskedArray ! Arithmetic is modular when using integer types, and no error is raised on overflow. Examples >>> marr = np.ma.array(np.arange(10), mask=[0,0,0,1,1,1,0,0,0,0])
>>> marr.cumsum()
masked_array(data=[0, 1, 3, --, --, --, 9, 16, 24, 33],
             mask=[False, False, False,  True,  True,  True, False, False,
                   False, False],
       fill_value=999999)
numpy.ma.MaskedArray.diagonal method   ma.MaskedArray.diagonal(offset=0, axis1=0, axis2=1)[source]
 
Return specified diagonals. In NumPy 1.9 the returned array is a read-only view instead of a copy as in previous NumPy versions. In a future version the read-only restriction will be removed. Refer to numpy.diagonal for full documentation.  See also  numpy.diagonal

equivalent function
numpy.ma.MaskedArray.dump method   ma.MaskedArray.dump(file)
 
Dump a pickle of the array to the specified file. The array can be read back with pickle.load or numpy.load.  Parameters 
 
filestr or Path


A string naming the dump file.  Changed in version 1.17.0: pathlib.Path objects are now accepted.
numpy.ma.MaskedArray.dumps method   ma.MaskedArray.dumps()
 
Returns the pickle of the array as a string. pickle.loads will convert the string back to an array.  Parameters 
 None
numpy.ma.MaskedArray.fill method   ma.MaskedArray.fill(value)
 
Fill the array with a scalar value.  Parameters 
 
valuescalar


All elements of a will be assigned this value.     Examples >>> a = np.array([1, 2])
>>> a.fill(0)
>>> a
array([0, 0])
>>> a = np.empty(2)
>>> a.fill(1)
>>> a
array([1.,  1.])
numpy.ma.MaskedArray.filled method   ma.MaskedArray.filled(fill_value=None)[source]
 
Return a copy of self, with masked values filled with a given value. However, if there are no masked values to fill, self will be returned instead as an ndarray.  Parameters 
 
fill_valuearray_like, optional


The value to use for invalid entries. Can be scalar or non-scalar. If non-scalar, the resulting ndarray must be broadcastable over input array. Default is None, in which case, the fill_value attribute of the array is used instead.    Returns 
 
filled_arrayndarray


A copy of self with invalid entries replaced by fill_value (be it the function argument or the attribute of self), or self itself as an ndarray if there are no invalid entries to be replaced.     Notes The result is not a MaskedArray! Examples >>> x = np.ma.array([1,2,3,4,5], mask=[0,0,1,0,1], fill_value=-999)
>>> x.filled()
array([   1,    2, -999,    4, -999])
>>> x.filled(fill_value=1000)
array([   1,    2, 1000,    4, 1000])
>>> type(x.filled())
<class 'numpy.ndarray'>
 Subclassing is preserved. This means that if, e.g., the data part of the masked array is a recarray, filled returns a recarray: >>> x = np.array([(-1, 2), (-3, 4)], dtype='i8,i8').view(np.recarray)
>>> m = np.ma.array(x, mask=[(True, False), (False, True)])
>>> m.filled()
rec.array([(999999,      2), (    -3, 999999)],
          dtype=[('f0', '<i8'), ('f1', '<i8')])
numpy.ma.MaskedArray.flags attribute   ma.MaskedArray.flags
 
Information about the memory layout of the array. Notes The flags object can be accessed dictionary-like (as in a.flags['WRITEABLE']), or by using lowercased attribute names (as in a.flags.writeable). Short flag names are only supported in dictionary access. Only the WRITEBACKIFCOPY, UPDATEIFCOPY, WRITEABLE, and ALIGNED flags can be changed by the user, via direct assignment to the attribute or dictionary entry, or by calling ndarray.setflags. The array flags cannot be set arbitrarily:  UPDATEIFCOPY can only be set False. WRITEBACKIFCOPY can only be set False. ALIGNED can only be set True if the data is truly aligned. WRITEABLE can only be set True if the array owns its own memory or the ultimate owner of the memory exposes a writeable buffer interface or is a string.  Arrays can be both C-style and Fortran-style contiguous simultaneously. This is clear for 1-dimensional arrays, but can also be true for higher dimensional arrays. Even for contiguous arrays a stride for a given dimension arr.strides[dim] may be arbitrary if arr.shape[dim] == 1 or the array has no elements. It does not generally hold that self.strides[-1] == self.itemsize for C-style contiguous arrays or self.strides[0] == self.itemsize for Fortran-style contiguous arrays is true.  Attributes 
 C_CONTIGUOUS (C)

The data is in a single, C-style contiguous segment.  F_CONTIGUOUS (F)

The data is in a single, Fortran-style contiguous segment.  OWNDATA (O)

The array owns the memory it uses or borrows it from another object.  WRITEABLE (W)

The data area can be written to. Setting this to False locks the data, making it read-only. A view (slice, etc.) inherits WRITEABLE from its base array at creation time, but a view of a writeable array may be subsequently locked while the base array remains writeable. (The opposite is not true, in that a view of a locked array may not be made writeable. However, currently, locking a base object does not lock any views that already reference it, so under that circumstance it is possible to alter the contents of a locked array via a previously created writeable view onto it.) Attempting to change a non-writeable array raises a RuntimeError exception.  ALIGNED (A)

The data and all elements are aligned appropriately for the hardware.  WRITEBACKIFCOPY (X)

This array is a copy of some other array. The C-API function PyArray_ResolveWritebackIfCopy must be called before deallocating to the base array will be updated with the contents of this array.  UPDATEIFCOPY (U)

(Deprecated, use WRITEBACKIFCOPY) This array is a copy of some other array. When this array is deallocated, the base array will be updated with the contents of this array.  FNC

F_CONTIGUOUS and not C_CONTIGUOUS.  FORC

F_CONTIGUOUS or C_CONTIGUOUS (one-segment test).  BEHAVED (B)

ALIGNED and WRITEABLE.  CARRAY (CA)

BEHAVED and C_CONTIGUOUS.  FARRAY (FA)

BEHAVED and F_CONTIGUOUS and not C_CONTIGUOUS.
numpy.ma.MaskedArray.flatten method   ma.MaskedArray.flatten(order='C')[source]
 
Return a copy of the array collapsed into one dimension.  Parameters 
 
order{‘C’, ‘F’, ‘A’, ‘K’}, optional


‘C’ means to flatten in row-major (C-style) order. ‘F’ means to flatten in column-major (Fortran- style) order. ‘A’ means to flatten in column-major order if a is Fortran contiguous in memory, row-major order otherwise. ‘K’ means to flatten a in the order the elements occur in memory. The default is ‘C’.    Returns 
 
yndarray


A copy of the input array, flattened to one dimension.      See also  ravel

Return a flattened array.  flat

A 1-D flat iterator over the array.    Examples >>> a = np.array([[1,2], [3,4]])
>>> a.flatten()
array([1, 2, 3, 4])
>>> a.flatten('F')
array([1, 3, 2, 4])
numpy.ma.MaskedArray.get_fill_value method   ma.MaskedArray.get_fill_value()[source]
 
The filling value of the masked array is a scalar. When setting, None will set to a default based on the data type. Examples >>> for dt in [np.int32, np.int64, np.float64, np.complex128]:
...     np.ma.array([0, 1], dtype=dt).get_fill_value()
...
999999
999999
1e+20
(1e+20+0j)
 >>> x = np.ma.array([0, 1.], fill_value=-np.inf)
>>> x.fill_value
-inf
>>> x.fill_value = np.pi
>>> x.fill_value
3.1415926535897931 # may vary
 Reset to default: >>> x.fill_value = None
>>> x.fill_value
1e+20
numpy.ma.MaskedArray.harden_mask method   ma.MaskedArray.harden_mask()[source]
 
Force the mask to hard. Whether the mask of a masked array is hard or soft is determined by its hardmask property. harden_mask sets hardmask to True.  See also  ma.MaskedArray.hardmask
numpy.ma.MaskedArray.ids method   ma.MaskedArray.ids()[source]
 
Return the addresses of the data and mask areas.  Parameters 
 None
   Examples >>> x = np.ma.array([1, 2, 3], mask=[0, 1, 1])
>>> x.ids()
(166670640, 166659832) # may vary
 If the array has no mask, the address of nomask is returned. This address is typically not close to the data in memory: >>> x = np.ma.array([1, 2, 3])
>>> x.ids()
(166691080, 3083169284) # may vary
numpy.ma.MaskedArray.iscontiguous method   ma.MaskedArray.iscontiguous()[source]
 
Return a boolean indicating whether the data is contiguous.  Parameters 
 None
   Examples >>> x = np.ma.array([1, 2, 3])
>>> x.iscontiguous()
True
 iscontiguous returns one of the flags of the masked array: >>> x.flags
  C_CONTIGUOUS : True
  F_CONTIGUOUS : True
  OWNDATA : False
  WRITEABLE : True
  ALIGNED : True
  WRITEBACKIFCOPY : False
  UPDATEIFCOPY : False
numpy.ma.MaskedArray.item method   ma.MaskedArray.item(*args)
 
Copy an element of an array to a standard Python scalar and return it.  Parameters 
 
*argsArguments (variable number and type)


 none: in this case, the method only works for arrays with one element (a.size == 1), which element is copied into a standard Python scalar object and returned. int_type: this argument is interpreted as a flat index into the array, specifying which element to copy and return. tuple of int_types: functions as does a single int_type argument, except that the argument is interpreted as an nd-index into the array.     Returns 
 
zStandard Python scalar object


A copy of the specified element of the array as a suitable Python scalar     Notes When the data type of a is longdouble or clongdouble, item() returns a scalar array object because there is no available Python scalar that would not lose information. Void arrays return a buffer object for item(), unless fields are defined, in which case a tuple is returned. item is very similar to a[args], except, instead of an array scalar, a standard Python scalar is returned. This can be useful for speeding up access to elements of the array and doing arithmetic on elements of the array using Python’s optimized math. Examples >>> np.random.seed(123)
>>> x = np.random.randint(9, size=(3, 3))
>>> x
array([[2, 2, 6],
       [1, 3, 6],
       [1, 0, 1]])
>>> x.item(3)
1
>>> x.item(7)
0
>>> x.item((0, 1))
2
>>> x.item((2, 2))
1
numpy.ma.MaskedArray.itemsize attribute   ma.MaskedArray.itemsize
 
Length of one array element in bytes. Examples >>> x = np.array([1,2,3], dtype=np.float64)
>>> x.itemsize
8
>>> x = np.array([1,2,3], dtype=np.complex128)
>>> x.itemsize
16
numpy.ma.MaskedArray.max method   ma.MaskedArray.max(axis=None, out=None, fill_value=None, keepdims=<no value>)[source]
 
Return the maximum 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 maximum_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 
 
amaxarray_like


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

Returns the maximum filling value for a given datatype.
numpy.ma.MaskedArray.mean method   ma.MaskedArray.mean(axis=None, dtype=None, out=None, keepdims=<no value>)[source]
 
Returns the average of the array elements along given axis. Masked entries are ignored, and result elements which are not finite will be masked. Refer to numpy.mean for full documentation.  See also  numpy.ndarray.mean

corresponding function for ndarrays  numpy.mean

Equivalent function  numpy.ma.average

Weighted average.    Examples >>> a = np.ma.array([1,2,3], mask=[False, False, True])
>>> a
masked_array(data=[1, 2, --],
             mask=[False, False,  True],
       fill_value=999999)
>>> a.mean()
1.5