numpy.trunc()

numpy.trunc(x[, out]) = Return the truncated value of the input, element-wise. The truncated value of the scalar x is the nearest integer i which is closer to zero than x is. In short, the fractional part of the signed number x is discarded. Parameters: x : array_like Input data. Returns: y : ndarray or scalar The truncated value of each element in x. See also ceil, floor, rint Notes New in version 1.3.0. Examples >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]

numpy.typename()

numpy.typename(char) [source] Return a description for the given data type code. Parameters: char : str Data type code. Returns: out : str Description of the input data type code. See also dtype, typecodes Examples >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] >>> for typechar in typechars: ... print(typechar, ' : ', np.typename(typechar)) ... S1 : character ?

numpy.triu_indices_from()

numpy.triu_indices_from(arr, k=0) [source] Return the indices for the upper-triangle of arr. See triu_indices for full details. Parameters: arr : ndarray, shape(N, N) The indices will be valid for square arrays. k : int, optional Diagonal offset (see triu for details). Returns: triu_indices_from : tuple, shape(2) of ndarray, shape(N) Indices for the upper-triangle of arr. See also triu_indices, triu Notes New in version 1.4.0.

numpy.true_divide()

numpy.true_divide(x1, x2[, out]) = Returns a true division of the inputs, element-wise. Instead of the Python traditional ?floor division?, this returns a true division. True division adjusts the output type to present the best answer, regardless of input types. Parameters: x1 : array_like Dividend array. x2 : array_like Divisor array. Returns: out : ndarray Result is scalar if both inputs are scalar, ndarray otherwise. Notes The floor division operator // was added in Python 2.2

numpy.triu_indices()

numpy.triu_indices(n, k=0, m=None) [source] Return the indices for the upper-triangle of an (n, m) array. Parameters: n : int The size of the arrays for which the returned indices will be valid. k : int, optional Diagonal offset (see triu for details). m : int, optional New in version 1.9.0. The column dimension of the arrays for which the returned arrays will be valid. By default m is taken equal to n. Returns: inds : tuple, shape(2) of ndarrays, shape(n) The indices for the tr

numpy.triu()

numpy.triu(m, k=0) [source] Upper triangle of an array. Return a copy of a matrix with the elements below the k-th diagonal zeroed. Please refer to the documentation for tril for further details. See also tril lower triangle of an array Examples >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) array([[ 1, 2, 3], [ 4, 5, 6], [ 0, 8, 9], [ 0, 0, 12]])

numpy.tril_indices_from()

numpy.tril_indices_from(arr, k=0) [source] Return the indices for the lower-triangle of arr. See tril_indices for full details. Parameters: arr : array_like The indices will be valid for square arrays whose dimensions are the same as arr. k : int, optional Diagonal offset (see tril for details). See also tril_indices, tril Notes New in version 1.4.0.

numpy.tril_indices()

numpy.tril_indices(n, k=0, m=None) [source] Return the indices for the lower-triangle of an (n, m) array. Parameters: n : int The row dimension of the arrays for which the returned indices will be valid. k : int, optional Diagonal offset (see tril for details). m : int, optional New in version 1.9.0. The column dimension of the arrays for which the returned arrays will be valid. By default m is taken equal to n. Returns: inds : tuple of arrays The indices for the triangle. The r

numpy.trim_zeros()

numpy.trim_zeros(filt, trim='fb') [source] Trim the leading and/or trailing zeros from a 1-D array or sequence. Parameters: filt : 1-D array or sequence Input array. trim : str, optional A string with ?f? representing trim from front and ?b? to trim from back. Default is ?fb?, trim zeros from both front and back of the array. Returns: trimmed : 1-D array or sequence The result of trimming the input. The input data type is preserved. Examples >>> a = np.array((0, 0, 0, 1,

numpy.tril()

numpy.tril(m, k=0) [source] Lower triangle of an array. Return a copy of an array with elements above the k-th diagonal zeroed. Parameters: m : array_like, shape (M, N) Input array. k : int, optional Diagonal above which to zero elements. k = 0 (the default) is the main diagonal, k < 0 is below it and k > 0 is above. Returns: tril : ndarray, shape (M, N) Lower triangle of m, of same shape and data-type as m. See also triu same thing, only for the upper triangle Examples