AmitDiwan has Published 10744 Articles

Convert angles from degrees to radians in Python

AmitDiwan

AmitDiwan

Updated on 24-Feb-2022 07:31:44

3K+ Views

To convert angles from degrees to radians, use the numpy.radians() method in Python Numpy. The method returns the corresponding radian values. This is a scalar if x is a scalar. The 1st parameter is an input array in degrees. The 2nd and 3rd parameters are optional.The 2nd parameter is an ... Read More

Compute the Natural Logarithm in Python

AmitDiwan

AmitDiwan

Updated on 24-Feb-2022 07:28:53

340 Views

The natural logarithm log is the inverse of the exponential function, so that log(exp(x)) = x. The natural logarithm is logarithm in base e. The method returns the natural logarithm of x, elementwise. This is a scalar if x is a scalar. The 1st parameter is the input value, array-like. ... Read More

Python - Merge DataFrames of different length

AmitDiwan

AmitDiwan

Updated on 23-Feb-2022 13:20:27

603 Views

To merge dataframes of different length, we need to use the merge() method. Let’s say the following is our 1st DataFrame with length 4 −dataFrame1 = pd.DataFrame(    {       "Car": ['BMW', 'Lexus', 'Audi', 'Jaguar']    } ) print("DataFrame1 ...", dataFrame1) print("DataFrame1 length = ", len(dataFrame1))Following is ... Read More

Java Program to Print Pyramid Star Pattern

AmitDiwan

AmitDiwan

Updated on 22-Feb-2022 13:19:45

747 Views

In this article, we will understand how to print pyramid star pattern. The pattern is formed by using multiple for-loops and print statements.Below is a demonstration of the same −InputSuppose our input is −Enter the number of rows : 8OutputThe desired output would be −The pyramid star pattern : ... Read More

Return True if all entries of two arrays are equal in Numpy

AmitDiwan

AmitDiwan

Updated on 22-Feb-2022 10:13:09

633 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 ... Read More

Clip (limit) the values in an array and place the result in another array in Numpy

AmitDiwan

AmitDiwan

Updated on 22-Feb-2022 09:48:00

354 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 ... Read More

Clip (limit) the values in a Numpy array

AmitDiwan

AmitDiwan

Updated on 22-Feb-2022 09:41:01

949 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 ... Read More

Generate a Vandermonde matrix and set the number of columns in the output in Numpy

AmitDiwan

AmitDiwan

Updated on 22-Feb-2022 09:37:20

285 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 ... Read More

Java Program to Make a Simple Calculator Using switch...case

AmitDiwan

AmitDiwan

Updated on 22-Feb-2022 09:22:12

4K+ Views

In this article, we will understand how to construct a simple calculator using switch-case. The switch statement evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case.Following are the arithmetic operations we are going to perform.AdditionSubtractionMultiplicationDivisionFloor DivisionModuloBelow is a demonstration of the ... Read More

Generate a Vandermonde matrix in Numpy

AmitDiwan

AmitDiwan

Updated on 22-Feb-2022 08:13:21

221 Views

To generate a Vandermonde matrix, use the np.ma.vander() method in Python Numpy. A Vandermonde matrix, named after Alexandre-Théophile Vandermonde, is a matrix with the terms of a geometric progression in each row.The columns of the output matrix are powers of the input vector. The order of the powers is determined ... Read More

Advertisements