- 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
66 Views
To return the x1 * 2**x2, element-wise, use the numpy.ldexp() method in Python Numpy. The 1st parameter X1 is the array of multipliers. The 2nd parameter X2 is the array of twos exponents. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).The out is a location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of ... Read More
468 Views
To extract the fractional and integral parts of a specific array value, use the index value inside the numpy.modf() method. The fractional and integral parts are negative if the given number is negative.The out is a location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.The condition is broadcast over the input. At locations where the condition is True, the out array will be ... Read More
2K+ Views
To cube each element in an array., element-wise, use the numpy.power() method in Python. Here, the 1st parameter is the base and the 2nd exponents. Since, we want the cube, the exponent is 3.Raise each base in x1 to the positionally-corresponding power in x2. x1 and x2 must be broadcastable to the same shape. An integer type raised to a negative integer power will raise a ValueError. Negative values raised to a non-integral value will return nan. To get complex results, cast the input to complex, or specify the dtype to be complex.StepsAt first, import the required library −import numpy ... Read More
1K+ Views
To power array elements of an array with a given value, use the numpy.power() method in Python. Here, the 1st parameter is the base and the 2nd exponents. The dtype parameter is used to set the output datatype.Raise each base in x1 to the positionally-corresponding power in x2. x1 and x2 must be broadcastable to the same shape. An integer type raised to a negative integer power will raise a ValueError. Negative values raised to a non-integral value will return nan. To get complex results, cast the input to complex, or specify the dtype to be complex.The condition is broadcast ... Read More
507 Views
To set the first array elements raised to powers from second array, element-wise, use the numpy.power() method in Python. Here, the 1st parameter is the base and the 2nd exponents.Raise each base in x1 to the positionally-corresponding power in x2. x1 and x2 must be broadcastable to the same shape. An integer type raised to a negative integer power will raise a ValueError. Negative values raised to a non-integral value will return nan. To get complex results, cast the input to complex, or specify the dtype to be complex.The out is a location into which the result is stored. If ... Read More
781 Views
To display the Numerical negative, use the np.negative() method in Python Numpy. The out is a location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.The condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out ... Read More
182 Views
To return the largest integer smaller or equal to the division of the inputs, use the numpy.floor_divide() method in Python Numpy. It returns the floor value after division. The parameter 1 is considered a Numerator. The parameter 2 is considered a Denominator.The out is a location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.The condition is broadcast over the input. At locations where ... Read More
104 Views
To true divide arguments element-wise, use the numpy.true_divide() method in Python Numpy. The arr1 is considered Dividend array. The arr2 is considered Divisor array. The output is set "float" using the "dtype" parameter.The out is a location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.The condition is broadcast over the input. At locations where the condition is True, the out array will be ... Read More
118 Views
To get the Logarithm of the sum of exponentiations of the inputs, use the numpy.logaddexp() method in Python Numpy.Calculate log(exp(x1) + exp(x2)). This function is useful in statistics where the calculated probabilities of events may be so small as to exceed the range of normal floating-point numbers. In such cases the logarithm of the calculated probability is stored. This function allows adding probabilities stored in such a fashion.NumPy offers comprehensive mathematical functions, random number generators, linear algebra routines, Fourier transforms, and more. It supports a wide range of hardware and computing platforms, and plays well with distributed, GPU, and sparse ... Read More
3K+ Views
To perform element-wise comparison of two string arrays using a comparison operator, use the numpy.compare_chararrays() method in Python Numpy. The arr1 and arr2 are the two input string arrays of the same shape to be compared. The 3rd parameter is rstrip, if True, the spaces at the end of Strings are removed before the comparison.NumPy offers comprehensive mathematical functions, random number generators, linear algebra routines, Fourier transforms, and more. It supports a wide range of hardware and computing platforms, and plays well with distributed, GPU, and sparse array libraries.StepsAt first, import the required library −import numpy as npCreate two One-Dimensional ... Read More