- 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
301 Views
To return the element-wise remainder of division, use the numpy.remainder() method in Python Numpy. Here, the 1st parameter is the Dividend array. The 2nd parameter is the Divisor array.Computes the remainder complementary to the floor_divide function. It is equivalent to the Python modulus operator''x1 % x2'' and has the same sign as the divisor x2. The MATLAB function equivalent to np.remainder is mod.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 ... Read More
558 Views
To raise the bases to different exponents, 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 condition is broadcast over the input. At locations where the condition is True, the out array will ... Read More
105 Views
To return the trunc of the array elements, element-wise, use the numpy.trunc() method in Python Numpy. The new location where we will store the result is a new array.The function returns the truncated value of each element in x. This is a scalar if x is a scalar. 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.The out is a location into which the result is stored. If provided, it must have a shape that the inputs ... Read More
93 Views
To return the truncated value of a specific element, use the index value in the numpy.trunc() method in Python Numpy.The function returns the truncated value of each element in x. This is a scalar if x is a scalar. 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.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 ... Read More
76 Views
To return mantissa and exponent as a pair of a given tuple, use the index value in the numpy.frexp() 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 ... Read More
78 Views
To return mantissa and exponent as a pair of a given list, use the index value in the numpy.frexp() 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 ... Read More
242 Views
The numpy.eye() returns a 2-D array with 1’s as the diagonal and 0’s elsewhere. Here, the 1st parameter means the "Number of rows in the output" i.e. 4 means 4x4 array. The 2nd parameter is the number of columns in the output.The function eye() returns an array where all elements are equal to zero, except for the k-th diagonal, whose values are equal to one. The dtype is the data-type of the returned array. The order suggests whether the output should be stored in row-major (C-style) or column-major (Fortran-style) order in memory.The like parameter is a reference object to allow ... Read More
72 Views
To return a new array with the same shape and type as a given array, use the numpy.empty_like() method in Python Numpy. It returns the array of uninitialized (arbitrary) data with the same shape and type as prototype. The 1st parameter here is the shape and data-type of prototype(array-like) that define these same attributes of the returned array. We have set the order to 'C' style using the "order" parameter.The order 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 ... Read More