nums.core.array.application module
-
class
nums.core.array.application.
ArrayApplication
(cm, fs)[source] Bases:
object
-
loadtxt
(fname, dtype=<class 'float'>, comments='# ', delimiter=' ', converters=None, skiprows=0, usecols=None, unpack=False, ndmin=0, encoding='bytes', max_rows=None, num_workers=None)[source] - Return type
-
map_bop
(op_name, arr_1, arr_2, out=None, where=True, args=None, kwargs=None)[source] A map for binary operators that applies element-wise to every entry of the input arrays.
- Parameters
op_name (
str
) – An element-wise binary operator.arr_1 (
BlockArray
) – A BlockArray.arr_2 (
BlockArray
) – A BlockArray.out (
Optional
[BlockArray
]) – A BlockArray to which the result is written.where – An indicator specifying the indices to which op is applied.
args – Args provided to op.
kwargs – Keyword args provided to op.
- Return type
- Returns
A BlockArray.
-
map_uop
(op_name, arr, out=None, where=True, args=None, kwargs=None)[source] A map, for unary operators, that applies to every entry of an array.
- Parameters
op_name (
str
) – An element-wise unary operator.arr (
BlockArray
) – A BlockArray.out (
Optional
[BlockArray
]) – A BlockArray to which the result is written.where – An indicator specifying the indices to which op is applied.
args – Args provided to op.
kwargs – Keyword args provided to op.
- Return type
- Returns
A BlockArray.
-
median
(arr)[source] Compute the median of a BlockArray.
- Parameters
a – A BlockArray.
- Return type
- Returns
The median value.
-
percentile
(arr, q, interpolation='linear', method='tdigest')[source] Compute the q-th percentile of the array elements. :type arr:
BlockArray
:param arr: BlockArray. :type q:float
:param q: Percentile to compute, which must be between 0 and 100 inclusive. :type interpolation:str
:param interpolation: interpolation method to use when the desired percentile lies between two :param data points i < j.: :param also see https: //numpy.org/doc/1.20/reference/generated/numpy.percentile.html.- Return type
- Returns
Returns the q-th percentile of the array elements.
-
quantile
(arr, q, interpolation='linear', method='tdigest')[source] Compute the q-th quantile of the array elements. :type arr:
BlockArray
:param arr: BlockArray. :type q:float
:param q: quantile to compute, which must be between 0 and 1 inclusive. :param interpolation: interpolation method to use when the desired quantile lies between two :param data points i < j.: :param also see https: //numpy.org/doc/1.20/reference/generated/numpy.quantile.html. :param also see https: //docs.dask.org/en/latest/_modules/dask/array/percentile.html.- Return type
- Returns
Returns the q-th quantile of the array elements.
-
read_csv
(filename, dtype=<class 'float'>, delimiter=', ', has_header=False, num_workers=None)[source]
-
top_k
(arr, k, largest=True)[source] Find the k largest or smallest elements of a BlockArray.
If there are multiple kth elements that are equal in value, then no guarantees are made as to which ones are included in the top k.
- Parameters
arr (
BlockArray
) – A BlockArray.k (
int
) – Number of top elements to return.largest – Whether to return largest or smallest elements.
- Return type
Tuple
[BlockArray
,BlockArray
]- Returns
A tuple containing two BlockArrays, (values, indices). values: Values of the top k elements, unsorted. indices: Indices of the top k elements, ordered by their corresponding values.
-