Found 1204 Articles for Numpy

Return the maximum of an array with negative infinity or maximum ignoring any NaNs in Python

AmitDiwan
Updated on 28-Feb-2022 09:32:07

587 Views

To return the maximum of an array or maximum ignoring any NaNs, use the numpy.nanmax() method in Python. The method returns an array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, an ndarray scalar is returned. The same dtype as a is returned. The 1st parameter, a is an array containing numbers whose maximum is desired. If a is not an array, a conversion is attempted.The 2nd parameter, axis is an axis or axes along which the maximum is computed. The default is to compute the ... Read More

Return the angle of the complex argument in degrees in Python

AmitDiwan
Updated on 28-Feb-2022 09:30:05

134 Views

To return the angle of the complex argument, use the numpy.angle() method in Python. The method returns the counterclockwise angle from the positive real axis on the complex plane in the range (-pi, pi], with dtype as numpy.float64. The 1st parameter z, A complex number or sequence of complex numbers. The 2nd parameter, deg, return angle in degrees if True, radians if False (default).StepsAt first, import the required libraries −import numpy as npCreate an array using the array() method −arr = np.array([1.0, 1.0j, 1+1j]) Display the array −print("Array...", arr)Get the type of the array −print("Our Array type...", arr.dtype) Get the ... Read More

Return the angle of the complex argument in Python

AmitDiwan
Updated on 28-Feb-2022 09:28:43

2K+ Views

To return the angle of the complex argument, use the numpy.angle() method in Python. The method returns the counterclockwise angle from the positive real axis on the complex plane in the range (-pi, pi], with dtype as numpy.float64. The 1st parameter z, A complex number or sequence of complex numbers. The 2nd parameter, deg, return angle in degrees if True, radians if False (default).StepsAt first, import the required libraries −import numpy as npCreate an array using the array() method −arr = np.array([1.0, 1.0j, 1+1j]) Display the array −print("Array...", arr)Get the type of the array −print("Our Array type...", arr.dtype) Get the ... Read More

Return the bases to different exponents in Python

AmitDiwan
Updated on 28-Feb-2022 09:24:46

144 Views

To return the bases when first array elements are raised to powers from second array, use the float_power() method in Python Numpy. The method returns the bases in x1 raised to the exponents in x2. This is a scalar if both x1 and x2 are scalars. The parameter x1 are the bases. The parameter x2 are the exponents.Raise each base in x1 to the positionally-corresponding power in x2. x1 and x2 must be broadcastable to the same shape. This differs from the power function in that integers, float16, and float32 are promoted to floats with a minimum precision of float64 ... Read More

Return the bases when first array elements are raised to powers from second array in Python

AmitDiwan
Updated on 28-Feb-2022 09:23:04

86 Views

To return the bases when first array elements are raised to powers from second array, use the float_power() method in Python Numpy. The method returns the bases in x1 raised to the exponents in x2. This is a scalar if both x1 and x2 are scalars. The parameter x1 are the bases. The parameter x2 are the exponents.Raise each base in x1 to the positionally-corresponding power in x2. x1 and x2 must be broadcastable to the same shape. This differs from the power function in that integers, float16, and float32 are promoted to floats with a minimum precision of float64 ... Read More

Return the modified Bessel function evaluated at each of the elements of x in Python

AmitDiwan
Updated on 28-Feb-2022 09:19:16

204 Views

To return the modified Bessel function evaluated at each of the elements of x, use the numpy.io() method. The parameter x is an Argument of the Bessel function. The method returns the modified Bessel function evaluated at each of the elements of x.StepsAt first, import the required libraries −import numpy as npCreate an array using the array() method −arr = np.array([10, 20, 30, 40, 50]) Display the array −print("Array...", arr)Get the type of the array −print("Our Array type...", arr.dtype) Get the dimensions of the Array −print("Our Array Dimension...", arr.ndim)Get the shape of the Array −print("Our Array Shape...", arr.shape) To return ... Read More

Integrate using the composite trapezoidal rule and set the sample points integrating in reverse in Python

AmitDiwan
Updated on 28-Feb-2022 09:18:09

135 Views

To integrate along the given axis using the composite trapezoidal rule, use the numpy.trapz() method. If x is provided, the integration happens in sequence along its elements - they are not sorted. The method returns the definite integral of ‘y’ = n-dimensional array as approximated along a single axis by the trapezoidal rule. If ‘y’ is a 1-dimensional array, then the result is a float. If ‘n’ is greater than 1, then the result is an ‘n-1’ dimensional array.The 1st parameter, y is the input array to integrate. The 2nd parameter, x is the sample points corresponding to the y ... Read More

Compute the inverse Hyperbolic tangent in Python

AmitDiwan
Updated on 28-Feb-2022 09:14:48

408 Views

The arctanh is a multivalued function: for each x there are infinitely many numbers z such that tanh(z) = x. The convention is to return the z whose imaginary part lies in [-pi/2, pi/2]. The inverse hyperbolic tangent is also known as atanh or tanh^-1.To compute the inverse Hyperbolic tangent, use the numpy.arctanh() method. The method returns the array of the same shape as x. This is a scalar if x is a scalar. The 1st parameter, x is input array. The 2nd and 3rd parameters are optional.The 2nd parameter is an ndarray, A location into which the result is ... Read More

Compute the inverse Hyperbolic cosine of array elements in Python

AmitDiwan
Updated on 28-Feb-2022 08:09:15

117 Views

The arccosh is a multivalued function: for each x there are infinitely many numbers z such that cosh(z) = x. The convention is to return the z whose imaginary part lies in [-pi, pi] and the real part in [0, inf]. For real-valued input data types, arccosh always returns real output. For each value that cannot be expressed as a real number or infinity, it yields nan and sets the invalid floating point error flag. For complex-valued input, arccosh is a complex analytical function that has a branch cut [-inf, 1] and is continuous from above on it.To compute the ... Read More

Return a boolean array which is True where the string element in array starts with prefix in Python

AmitDiwan
Updated on 28-Feb-2022 08:06:42

277 Views

To return a boolean array which is True where the string element in array starts with prefix, use the numpy.char.startswith() method in Python Numpy. The first parameter is the input array. The second parameter is the prefix.StepsAt first, import the required libraries −import numpy as npCreate a One-Dimensional array of strings −arr = np.array(['KATIE', 'JOHN', 'KATE', 'KmY', 'BRAD']) Displaying our array −print("Array...", arr)Get the datatype −print("Array datatype...", arr.dtype) Get the dimensions of the Array −print("Array Dimensions...", arr.ndim)Get the shape of the Array −print("Our Array Shape...", arr.shape) Get the number of elements of the Array −print("Number of elements in the Array...", ... Read More

Advertisements