neulab/docprompting-conala huggingface dataset:
numpy.ma.default_fill_value   ma.default_fill_value(obj)[source]
 
Return the default fill value for the argument object. The default filling value depends on the datatype of the input array or the type of the input scalar:   
datatype default   
bool True  
int 999999  
float 1.e20  
complex 1.e20+0j  
object ‘?’  
string ‘N/A’   For structured types, a structured scalar is returned, with each field the default fill value for its type. For subarray types, the fill value is an array of the same size containing the default scalar fill value.  Parameters 
 
objndarray, dtype or scalar


The array data-type or scalar for which the default fill value is returned.    Returns 
 
fill_valuescalar


The default fill value.     Examples >>> np.ma.default_fill_value(1)
999999
>>> np.ma.default_fill_value(np.array([1.1, 2., np.pi]))
1e+20
>>> np.ma.default_fill_value(np.dtype(complex))
(1e+20+0j)
numpy.ma.diag   ma.diag(v, k=0)[source]
 
Extract a diagonal or construct a diagonal array. This function is the equivalent of numpy.diag that takes masked values into account, see numpy.diag for details.  See also  numpy.diag

Equivalent function for ndarrays.
numpy.ma.diff   ma.diff(*args, **kwargs) = <numpy.ma.core._convert2ma object>
 
Calculate the n-th discrete difference along the given axis. The first difference is given by out[i] = a[i+1] - a[i] along the given axis, higher differences are calculated by using diff recursively.  Parameters 
 
aarray_like


Input array  
nint, optional


The number of times values are differenced. If zero, the input is returned as-is.  
axisint, optional


The axis along which the difference is taken, default is the last axis.  
prepend, appendarray_like, optional


Values to prepend or append to a along axis prior to performing the difference. Scalar values are expanded to arrays with length 1 in the direction of axis and the shape of the input array in along all other axes. Otherwise the dimension and shape must match a except along axis.  New in version 1.16.0.     Returns 
 
diffMaskedArray


The n-th differences. The shape of the output is the same as a except along axis where the dimension is smaller by n. The type of the output is the same as the type of the difference between any two elements of a. This is the same as the type of a in most cases. A notable exception is datetime64, which results in a timedelta64 output array.      See also  
gradient, ediff1d, cumsum

  Notes Type is preserved for boolean arrays, so the result will contain False when consecutive elements are the same and True when they differ. For unsigned integer arrays, the results will also be unsigned. This should not be surprising, as the result is consistent with calculating the difference directly: >>> u8_arr = np.array([1, 0], dtype=np.uint8)
>>> np.diff(u8_arr)
array([255], dtype=uint8)
>>> u8_arr[1,...] - u8_arr[0,...]
255
 If this is not desirable, then the array should be cast to a larger integer type first: >>> i16_arr = u8_arr.astype(np.int16)
>>> np.diff(i16_arr)
array([-1], dtype=int16)
 Examples >>> x = np.array([1, 2, 4, 7, 0])
>>> np.diff(x)
array([ 1,  2,  3, -7])
>>> np.diff(x, n=2)
array([  1,   1, -10])
 >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]])
>>> np.diff(x)
array([[2, 3, 4],
       [5, 1, 2]])
>>> np.diff(x, axis=0)
array([[-1,  2,  0, -2]])
 >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64)
>>> np.diff(x)
array([1, 1], dtype='timedelta64[D]')
numpy.ma.dot   ma.dot(a, b, strict=False, out=None)[source]
 
Return the dot product of two arrays. This function is the equivalent of numpy.dot that takes masked values into account. Note that strict and out are in different position than in the method version. In order to maintain compatibility with the corresponding method, it is recommended that the optional arguments be treated as keyword only. At some point that may be mandatory.  Note Works only with 2-D arrays at the moment.   Parameters 
 
a, bmasked_array_like


Inputs arrays.  
strictbool, optional


Whether masked data are propagated (True) or set to 0 (False) for the computation. Default is False. Propagating the mask means that if a masked value appears in a row or column, the whole row or column is considered masked.  
outmasked_array, optional


Output argument. This must have the exact kind that would be returned if it was not used. In particular, it must have the right type, must be C-contiguous, and its dtype must be the dtype that would be returned for dot(a,b). This is a performance feature. Therefore, if these conditions are not met, an exception is raised, instead of attempting to be flexible.  New in version 1.10.2.       See also  numpy.dot

Equivalent function for ndarrays.    Examples >>> a = np.ma.array([[1, 2, 3], [4, 5, 6]], mask=[[1, 0, 0], [0, 0, 0]])
>>> b = np.ma.array([[1, 2], [3, 4], [5, 6]], mask=[[1, 0], [0, 0], [0, 0]])
>>> np.ma.dot(a, b)
masked_array(
  data=[[21, 26],
        [45, 64]],
  mask=[[False, False],
        [False, False]],
  fill_value=999999)
>>> np.ma.dot(a, b, strict=True)
masked_array(
  data=[[--, --],
        [--, 64]],
  mask=[[ True,  True],
        [ True, False]],
  fill_value=999999)
numpy.ma.dstack   ma.dstack(*args, **kwargs) = <numpy.ma.extras._fromnxfunction_seq object>
 
Stack arrays in sequence depth wise (along third axis). This is equivalent to concatenation along the third axis after 2-D arrays of shape (M,N) have been reshaped to (M,N,1) and 1-D arrays of shape (N,) have been reshaped to (1,N,1). Rebuilds arrays divided by dsplit. This function makes most sense for arrays with up to 3 dimensions. For instance, for pixel-data with a height (first axis), width (second axis), and r/g/b channels (third axis). The functions concatenate, stack and block provide more general stacking and concatenation operations.  Parameters 
 
tupsequence of arrays


The arrays must have the same shape along all but the third axis. 1-D or 2-D arrays must have the same shape.    Returns 
 
stackedndarray


The array formed by stacking the given arrays, will be at least 3-D.      See also  concatenate

Join a sequence of arrays along an existing axis.  stack

Join a sequence of arrays along a new axis.  block

Assemble an nd-array from nested lists of blocks.  vstack

Stack arrays in sequence vertically (row wise).  hstack

Stack arrays in sequence horizontally (column wise).  column_stack

Stack 1-D arrays as columns into a 2-D array.  dsplit

Split array along third axis.    Notes The function is applied to both the _data and the _mask, if any. Examples >>> a = np.array((1,2,3))
>>> b = np.array((2,3,4))
>>> np.dstack((a,b))
array([[[1, 2],
        [2, 3],
        [3, 4]]])
 >>> a = np.array([[1],[2],[3]])
>>> b = np.array([[2],[3],[4]])
>>> np.dstack((a,b))
array([[[1, 2]],
       [[2, 3]],
       [[3, 4]]])
numpy.ma.ediff1d   ma.ediff1d(arr, to_end=None, to_begin=None)[source]
 
Compute the differences between consecutive elements of an array. This function is the equivalent of numpy.ediff1d that takes masked values into account, see numpy.ediff1d for details.  See also  numpy.ediff1d

Equivalent function for ndarrays.
numpy.ma.empty   ma.empty(shape, dtype=float, order='C', *, like=None) = <numpy.ma.core._convert2ma object>
 
Return a new array of given shape and type, without initializing entries.  Parameters 
 
shapeint or tuple of int


Shape of the empty array, e.g., (2, 3) or 2.  
dtypedata-type, optional


Desired output data-type for the array, e.g, numpy.int8. Default is numpy.float64.  
order{‘C’, ‘F’}, optional, default: ‘C’


Whether to store multi-dimensional data in row-major (C-style) or column-major (Fortran-style) order in memory.  
likearray_like


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


Array of uninitialized (arbitrary) data of the given shape, dtype, and order. Object arrays will be initialized to None.      See also  empty_like

Return an empty array with shape and type of input.  ones

Return a new array setting values to one.  zeros

Return a new array setting values to zero.  full

Return a new array of given shape filled with value.    Notes empty, unlike zeros, does not set the array values to zero, and may therefore be marginally faster. On the other hand, it requires the user to manually set all the values in the array, and should be used with caution. Examples >>> np.empty([2, 2])
array([[ -9.74499359e+001,   6.69583040e-309],
       [  2.13182611e-314,   3.06959433e-309]])         #uninitialized
 >>> np.empty([2, 2], dtype=int)
array([[-1073741821, -1067949133],
       [  496041986,    19249760]])                     #uninitialized
numpy.ma.empty_like   ma.empty_like(prototype, dtype=None, order='K', subok=True, shape=None) = <numpy.ma.core._convert2ma object>
 
Return a new array with the same shape and type as a given array.  Parameters 
 
prototypearray_like


The shape and data-type of prototype define these same attributes of the returned array.  
dtypedata-type, optional


Overrides the data type of the result.  New in version 1.6.0.   
order{‘C’, ‘F’, ‘A’, or ‘K’}, optional


Overrides the memory layout of the result. ‘C’ means C-order, ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of prototype as closely as possible.  New in version 1.6.0.   
subokbool, optional.


If True, then the newly created array will use the sub-class type of prototype, otherwise it will be a base-class array. Defaults to True.  
shapeint or sequence of ints, optional.


Overrides the shape of the result. If order=’K’ and the number of dimensions is unchanged, will try to keep order, otherwise, order=’C’ is implied.  New in version 1.17.0.     Returns 
 
outMaskedArray


Array of uninitialized (arbitrary) data with the same shape and type as prototype.      See also  ones_like

Return an array of ones with shape and type of input.  zeros_like

Return an array of zeros with shape and type of input.  full_like

Return a new array with shape of input filled with value.  empty

Return a new uninitialized array.    Notes This function does not initialize the returned array; to do that use zeros_like or ones_like instead. It may be marginally faster than the functions that do set the array values. Examples >>> a = ([1,2,3], [4,5,6])                         # a is array-like
>>> np.empty_like(a)
array([[-1073741821, -1073741821,           3],    # uninitialized
       [          0,           0, -1073741821]])
>>> a = np.array([[1., 2., 3.],[4.,5.,6.]])
>>> np.empty_like(a)
array([[ -2.00000715e+000,   1.48219694e-323,  -2.00000572e+000], # uninitialized
       [  4.38791518e-305,  -2.00000715e+000,   4.17269252e-309]])
numpy.ma.expand_dims   ma.expand_dims(a, axis)[source]
 
Expand the shape of an array. Insert a new axis that will appear at the axis position in the expanded array shape.  Parameters 
 
aarray_like


Input array.  
axisint or tuple of ints


Position in the expanded axes where the new axis (or axes) is placed.  Deprecated since version 1.13.0: Passing an axis where axis > a.ndim will be treated as axis == a.ndim, and passing axis < -a.ndim - 1 will be treated as axis == 0. This behavior is deprecated.   Changed in version 1.18.0: A tuple of axes is now supported. Out of range axes as described above are now forbidden and raise an AxisError.     Returns 
 
resultndarray


View of a with the number of dimensions increased.      See also  squeeze

The inverse operation, removing singleton dimensions  reshape

Insert, remove, and combine dimensions, and resize existing ones  
doc.indexing, atleast_1d, atleast_2d, atleast_3d

  Examples >>> x = np.array([1, 2])
>>> x.shape
(2,)
 The following is equivalent to x[np.newaxis, :] or x[np.newaxis]: >>> y = np.expand_dims(x, axis=0)
>>> y
array([[1, 2]])
>>> y.shape
(1, 2)
 The following is equivalent to x[:, np.newaxis]: >>> y = np.expand_dims(x, axis=1)
>>> y
array([[1],
       [2]])
>>> y.shape
(2, 1)
 axis may also be a tuple: >>> y = np.expand_dims(x, axis=(0, 1))
>>> y
array([[[1, 2]]])
 >>> y = np.expand_dims(x, axis=(2, 0))
>>> y
array([[[1],
        [2]]])
 Note that some examples may use None instead of np.newaxis. These are the same objects: >>> np.newaxis is None
True
numpy.ma.filled   ma.filled(a, fill_value=None)[source]
 
Return input as an array with masked data replaced by a fill value. If a is not a MaskedArray, a itself is returned. If a is a MaskedArray and fill_value is None, fill_value is set to a.fill_value.  Parameters 
 
aMaskedArray or array_like


An input object.  
fill_valuearray_like, optional.


Can be scalar or non-scalar. If non-scalar, the resulting filled array should be broadcastable over input array. Default is None.    Returns 
 
andarray


The filled array.      See also  compressed
  Examples >>> x = np.ma.array(np.arange(9).reshape(3, 3), mask=[[1, 0, 0],
...                                                   [1, 0, 0],
...                                                   [0, 0, 0]])
>>> x.filled()
array([[999999,      1,      2],
       [999999,      4,      5],
       [     6,      7,      8]])
>>> x.filled(fill_value=333)
array([[333,   1,   2],
       [333,   4,   5],
       [  6,   7,   8]])
>>> x.filled(fill_value=np.arange(3))
array([[0, 1, 2],
       [0, 4, 5],
       [6, 7, 8]])
numpy.ma.fix_invalid   ma.fix_invalid(a, mask=False, copy=True, fill_value=None)[source]
 
Return input with invalid data masked and replaced by a fill value. Invalid data means values of nan, inf, etc.  Parameters 
 
aarray_like


Input array, a (subclass of) ndarray.  
masksequence, optional


Mask. Must be convertible to an array of booleans with the same shape as data. True indicates a masked (i.e. invalid) data.  
copybool, optional


Whether to use a copy of a (True) or to fix a in place (False). Default is True.  
fill_valuescalar, optional


Value used for fixing invalid data. Default is None, in which case the a.fill_value is used.    Returns 
 
bMaskedArray


The input array with invalid entries fixed.     Notes A copy is performed by default. Examples >>> x = np.ma.array([1., -1, np.nan, np.inf], mask=[1] + [0]*3)
>>> x
masked_array(data=[--, -1.0, nan, inf],
             mask=[ True, False, False, False],
       fill_value=1e+20)
>>> np.ma.fix_invalid(x)
masked_array(data=[--, -1.0, --, --],
             mask=[ True, False,  True,  True],
       fill_value=1e+20)
 >>> fixed = np.ma.fix_invalid(x)
>>> fixed.data
array([ 1.e+00, -1.e+00,  1.e+20,  1.e+20])
>>> x.data
array([ 1., -1., nan, inf])
numpy.ma.flatnotmasked_contiguous   ma.flatnotmasked_contiguous(a)[source]
 
Find contiguous unmasked data in a masked array along the given axis.  Parameters 
 
anarray


The input array.    Returns 
 
slice_listlist


A sorted sequence of slice objects (start index, end index).  Changed in version 1.15.0: Now returns an empty list instead of None for a fully masked array       See also  
flatnotmasked_edges, notmasked_contiguous, notmasked_edges


clump_masked, clump_unmasked

  Notes Only accepts 2-D arrays at most. Examples >>> a = np.ma.arange(10)
>>> np.ma.flatnotmasked_contiguous(a)
[slice(0, 10, None)]
 >>> mask = (a < 3) | (a > 8) | (a == 5)
>>> a[mask] = np.ma.masked
>>> np.array(a[~a.mask])
array([3, 4, 6, 7, 8])
 >>> np.ma.flatnotmasked_contiguous(a)
[slice(3, 5, None), slice(6, 9, None)]
>>> a[:] = np.ma.masked
>>> np.ma.flatnotmasked_contiguous(a)
[]
numpy.ma.flatnotmasked_edges   ma.flatnotmasked_edges(a)[source]
 
Find the indices of the first and last unmasked values. Expects a 1-D MaskedArray, returns None if all values are masked.  Parameters 
 
aarray_like


Input 1-D MaskedArray    Returns 
 
edgesndarray or None


The indices of first and last non-masked value in the array. Returns None if all values are masked.      See also  
flatnotmasked_contiguous, notmasked_contiguous, notmasked_edges


clump_masked, clump_unmasked

  Notes Only accepts 1-D arrays. Examples >>> a = np.ma.arange(10)
>>> np.ma.flatnotmasked_edges(a)
array([0, 9])
 >>> mask = (a < 3) | (a > 8) | (a == 5)
>>> a[mask] = np.ma.masked
>>> np.array(a[~a.mask])
array([3, 4, 6, 7, 8])
 >>> np.ma.flatnotmasked_edges(a)
array([3, 8])
 >>> a[:] = np.ma.masked
>>> print(np.ma.flatnotmasked_edges(a))
None
numpy.ma.frombuffer   ma.frombuffer(buffer, dtype=float, count=- 1, offset=0, *, like=None) = <numpy.ma.core._convert2ma object>
 
Interpret a buffer as a 1-dimensional array.  Parameters 
 
bufferbuffer_like


An object that exposes the buffer interface.  
dtypedata-type, optional


Data-type of the returned array; default: float.  
countint, optional


Number of items to read. -1 means all data in the buffer.  
offsetint, optional


Start reading the buffer from this offset (in bytes); default: 0.  
likearray_like


Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.  New in version 1.20.0.     Returns 
 out: MaskedArray
   Notes If the buffer has data that is not in machine byte-order, this should be specified as part of the data-type, e.g.: >>> dt = np.dtype(int)
>>> dt = dt.newbyteorder('>')
>>> np.frombuffer(buf, dtype=dt) 
 The data of the resulting array will not be byteswapped, but will be interpreted correctly. Examples >>> s = b'hello world'
>>> np.frombuffer(s, dtype='S1', count=5, offset=6)
array([b'w', b'o', b'r', b'l', b'd'], dtype='|S1')
 >>> np.frombuffer(b'\x01\x02', dtype=np.uint8)
array([1, 2], dtype=uint8)
>>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3)
array([1, 2, 3], dtype=uint8)
numpy.ma.fromfunction   ma.fromfunction(function, shape, **dtype) = <numpy.ma.core._convert2ma object>
 
Construct an array by executing a function over each coordinate. The resulting array therefore has a value fn(x, y, z) at coordinate (x, y, z).  Parameters 
 
functioncallable


The function is called with N parameters, where N is the rank of shape. Each parameter represents the coordinates of the array varying along a specific axis. For example, if shape were (2, 2), then the parameters would be array([[0, 0], [1, 1]]) and array([[0, 1], [0, 1]])  
shape(N,) tuple of ints


Shape of the output array, which also determines the shape of the coordinate arrays passed to function.  
dtypedata-type, optional


Data-type of the coordinate arrays passed to function. By default, dtype is float.  
likearray_like


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

The result of the call to function is passed back directly. Therefore the shape of fromfunction is completely determined by function. If function returns a scalar value, the shape of fromfunction would not match the shape parameter.      See also  
indices, meshgrid

  Notes Keywords other than dtype are passed to function. Examples >>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int)
array([[ True, False, False],
       [False,  True, False],
       [False, False,  True]])
 >>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int)
array([[0, 1, 2],
       [1, 2, 3],
       [2, 3, 4]])
numpy.ma.getdata   ma.getdata(a, subok=True)[source]
 
Return the data of a masked array as an ndarray. Return the data of a (if any) as an ndarray if a is a MaskedArray, else return a as a ndarray or subclass (depending on subok) if not.  Parameters 
 
aarray_like


Input MaskedArray, alternatively a ndarray or a subclass thereof.  
subokbool


Whether to force the output to be a pure ndarray (False) or to return a subclass of ndarray if appropriate (True, default).      See also  getmask

Return the mask of a masked array, or nomask.  getmaskarray

Return the mask of a masked array, or full array of False.    Examples >>> import numpy.ma as ma
>>> a = ma.masked_equal([[1,2],[3,4]], 2)
>>> a
masked_array(
  data=[[1, --],
        [3, 4]],
  mask=[[False,  True],
        [False, False]],
  fill_value=2)
>>> ma.getdata(a)
array([[1, 2],
       [3, 4]])
 Equivalently use the MaskedArray data attribute. >>> a.data
array([[1, 2],
       [3, 4]])
numpy.ma.getmask   ma.getmask(a)[source]
 
Return the mask of a masked array, or nomask. Return the mask of a as an ndarray if a is a MaskedArray and the mask is not nomask, else return nomask. To guarantee a full array of booleans of the same shape as a, use getmaskarray.  Parameters 
 
aarray_like


Input MaskedArray for which the mask is required.      See also  getdata

Return the data of a masked array as an ndarray.  getmaskarray

Return the mask of a masked array, or full array of False.    Examples >>> import numpy.ma as ma
>>> a = ma.masked_equal([[1,2],[3,4]], 2)
>>> a
masked_array(
  data=[[1, --],
        [3, 4]],
  mask=[[False,  True],
        [False, False]],
  fill_value=2)
>>> ma.getmask(a)
array([[False,  True],
       [False, False]])
 Equivalently use the MaskedArray mask attribute. >>> a.mask
array([[False,  True],
       [False, False]])
 Result when mask == nomask >>> b = ma.masked_array([[1,2],[3,4]])
>>> b
masked_array(
  data=[[1, 2],
        [3, 4]],
  mask=False,
  fill_value=999999)
>>> ma.nomask
False
>>> ma.getmask(b) == ma.nomask
True
>>> b.mask == ma.nomask
True
numpy.ma.getmaskarray   ma.getmaskarray(arr)[source]
 
Return the mask of a masked array, or full boolean array of False. Return the mask of arr as an ndarray if arr is a MaskedArray and the mask is not nomask, else return a full boolean array of False of the same shape as arr.  Parameters 
 
arrarray_like


Input MaskedArray for which the mask is required.      See also  getmask

Return the mask of a masked array, or nomask.  getdata

Return the data of a masked array as an ndarray.    Examples >>> import numpy.ma as ma
>>> a = ma.masked_equal([[1,2],[3,4]], 2)
>>> a
masked_array(
  data=[[1, --],
        [3, 4]],
  mask=[[False,  True],
        [False, False]],
  fill_value=2)
>>> ma.getmaskarray(a)
array([[False,  True],
       [False, False]])
 Result when mask == nomask >>> b = ma.masked_array([[1,2],[3,4]])
>>> b
masked_array(
  data=[[1, 2],
        [3, 4]],
  mask=False,
  fill_value=999999)
>>> ma.getmaskarray(b)
array([[False, False],
       [False, False]])
numpy.ma.harden_mask   ma.harden_mask(self) = <numpy.ma.core._frommethod object>
 
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