- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1204 Articles for Numpy
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
170 Views
To compute the condition number of a matrix in linear algebra, use the numpy.linalg.cond() method in Python. This method is capable of returning the condition number using one of seven different norms, depending on the value of p. Returns the condition number of the matrix. May be infinite.The condition number of x is defined as the norm of x times the norm of the inverse of x; the norm can be the usual L2-norm or one of a number of other matrix norms. The 1st parameter is x, the matrix whose condition number is sought. The 2nd parameter is p, ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
199 Views
To return the Norm of the matrix or vector in Linear Algebra, use the LA.norm() method in Python Numpy. The 1st parameter, x is an input array. If axis is None, x must be 1-D or 2-D, unless ord is None. If both axis and ord are None, the 2-norm of x.ravel will be returned. The 2nd parameter, ord is the order of the norm. The inf means numpy’s inf object. The default is None.The 3rd parameter axis, if an integer, specifies the axis of x along which to compute the vector norms. If axis is a 2-tuple, it specifies ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
723 Views
To compute the eigenvalues of a complex Hermitian or real symmetric matrix, use the numpy.eigvalsh() method. The method returns the eigenvalues in ascending order, each repeated according to its multiplicity.The 1st parameter, a is a complex- or real-valued matrix whose eigenvalues are to be computed. The 2nd parameter, UPLO specifies whether the calculation is done with the lower triangular part of a (‘L’, default) or the upper triangular part (‘U’). Irrespective of this value only the real parts of the diagonal will be considered in the computation to preserve the notion of a Hermitian matrix. It therefore follows that the ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
369 Views
To return the Cholesky decomposition, use the numpy.linalg.cholesky() method. Return the Cholesky decomposition, L * L.H, of the square matrix a, where L is lower-triangular and .H is the conjugate transpose operator. The a must be Hermitian and positive-definite. No checking is performed to verify whether a is Hermitian or not. In addition, only the lower-triangular and diagonal elements of a are used. Only L is actually returned.Then parameter a, is the Hermitian (symmetric if all elements are real), positive-definite input matrix. The method returns the Upper or lower-triangular Cholesky factor of a. Returns a matrix object if a is ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
182 Views
To get the Kronecker product of a 4D and a 3D dimension array, use the numpy.kron() method in Python Numpy. Compute the Kronecker product, a composite array made of blocks of the second array scaled by the firstThe function assumes that the number of dimensions of a and b are the same, if necessary prepending the smallest with ones. If a.shape = (r0, r1, .., rN) and b.shape = (s0, s1, ..., sN), the Kronecker product has shape (r0*s0, r1*s1, ..., rN*SN). The elements are products of elements from a and b, organized explicitly by −kron(a, b)[k0, k1, ..., kN] ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
185 Views
To return the scalar dtype or NumPy equivalent of Python type of an object, use the numpy.obj2sctype() method. The 1st parameter is the object of which the type is returned The default parameter, if given, is returned for objects whose types cannot be determined. If not given, None is returned for those objects.StepsAt first, import the required library −import numpy as npTo return the scalar dtype or NumPy equivalent of Python type of an object, use the numpy.obj2sctype() method −print("Using the obj2sctype() method in Numpy")Checking for int −print("Result...", np.obj2sctype(np.array([45, 89]))) print("Result...", np.obj2sctype(np.array([389, 7985])))Checking for float −print("Result...", np.obj2sctype(np.float32)) print("Result...", np.obj2sctype(np.float64)) print("Result...", ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
472 Views
To return True if all entries of two arrays are equal, use the ma.allequal() method in Python Numpy. Returns True if the two arrays are equal within the given tolerance, False otherwise. If either array contains NaN, then False is returned.The fill_value sets whether masked values in a or b are considered equal (True) or not (False). A masked array is the combination of a standard numpy.ndarray and a mask. A mask is either nomask, indicating that no value of the associated array is invalid, or an array of booleans that determines for each element of the associated array whether ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
250 Views
To clip (limit) the values in an array, use the np.ma.clip() method in Python Numpy. The "out" parameter is where results will be placed in this array. It may be the input array for in-place clipping. out must be of the right shape to hold the output. Its type is preserved. . Given an interval, values outside the interval are clipped to the interval edges. For example, if an interval of [0, 1] is specified, values smaller than 0 become 0, and values larger than 1 become 1. Equivalent to but faster than np.minimum(a_max, np.maximum(a, a_min)).The function returns an array ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
694 Views
To clip (limit) the values in an array, use the np.ma.clip() method in Python Numpy. Given an interval, values outside the interval are clipped to the interval edges. For example, if an interval of [0, 1] is specified, values smaller than 0 become 0, and values larger than 1 become 1. Equivalent to but faster than np.minimum(a_max, np.maximum(a, a_min)).The out is where the results will be placed in this array. It may be the input array for in-place clipping. out must be of the right shape to hold the output. Its type is preserved.The function returns an array with the ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
229 Views
To generate a Vandermonde matrix, use the np.ma.vander() method in Python Numpy. Set the number of columns in the output using the N parameter. If N is not specified, a square array is returned (N = len(x)).The columns of the output matrix are powers of the input vector. The order of the powers is determined by the increasing boolean argument. Specifically, when increasing is False, the i-th output column is the input vector raised element-wise to the power of N - i - 1. Such a matrix with a geometric progression in each row is named for Alexandre- Theophile Vandermonde.StepsAt ... Read More