- 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 10784 Articles for Python
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
65 Views
To test whether similar float type of different sizes are subdtypes of floating class, use the numpy.issubdtype() method in Python Numpy. The parameters are the dtype or object coercible to one.StepsAt first, import the required library −import numpy as npUsing the issubdtype() method in Numpy. Checking for floating point datatype with different sizes −print("Result...", np.issubdtype(np.float16, np.floating)) print("Result...", np.issubdtype(np.float32, np.floating)) print("Result...", np.issubdtype(np.float64, np.floating))Exampleimport numpy as np # To test whether similar float type of different sizes are subdtypes of floating class, use the numpy.issubdtype() method in Python Numpy. # The parameters are the dtype or object coercible to one print("Using ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
4K+ Views
To find the Trigonometric cosine of an array of angles given in degrees, use the numpy.cos() method in Python Numpy. The method returns the cosine of each element of the 1st parameter x. The 1st parameter, x, is an Angle, in radians (2pi means 360 degrees). Here, it is an array of angles. The 2nd and 3rd parameters are optional.The 2nd parameter is an ndarray, 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 must have length ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
To find the Trigonometric cosine, use the numpy.cos() method in Python Numpy. The method returns the sine of each element of the 1st parameter x. The 1st parameter, x, is an Angle, in radians (2pi means 360 degrees). The 2nd and 3rd parameters are optional. The 2nd parameter is an ndarray, 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 freshlyallocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.The 3rd parameter is ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
105 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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
128 Views
To determine if a class is a subclass of a second class, use the numpy.issubclass_() method in Python numpy. The 1st argument is the input class. True is returned if arg1 is a subclass of arg2. The 2nd argument is the input class. If a tuple of classes, True is returned if arg1 is a subclass of any of the tuple elements. The issubclass_ is equivalent to the Python built-in issubclass, except that it returns False instead of raising a TypeError if one of the arguments is not a class.StepsAt first, import the required library −import numpy as npUsing the ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
281 Views
To get the Trigonometric sines of an array of angles given in degrees, use the numpy.sin() method in Python Numpy. The method returns the sine of each element of the 1st parameter x. This is a scalar if is a scalar. The 1st parameter, x, is an Angle, in radians (2pi means 360 degrees). Here, it is an array of angles. The 2nd and 3rd parameters are optional.The 2nd parameter is an ndarray, 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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
To find the Trigonometric sine of an angle, use the numpy.sin() method in Python Numpy. The method returns the sine of each element of the 1st parameter x. The 1st parameter, x, is an Angle, in radians (2pi means 360 degrees). The 2nd and 3rd parameters are optional.The 2nd parameter is an ndarray, 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 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
104 Views
To return the scalar type of highest precision of the same kind as the input, use the maximum_sctype() method in Python Numpy. The parameter is the input data type. This can be a dtype object or an object that is convertible to a dtype.StepsAt first, import the required library −import numpy as npUsing the maximum_sctype() method in Numpy. Get the scalar type of highest precision −print("Result...", np.maximum_sctype(int)) print("Result...", np.maximum_sctype(np.uint8)) print("Result...", np.maximum_sctype(complex)) print("Result...", np.maximum_sctype(str)) print("Result...", np.maximum_sctype('f4')) print("Result...", np.maximum_sctype('i2')) print("Result...", np.maximum_sctype('i4')) print("Result...", np.maximum_sctype('i8'))Exampleimport numpy as np # To return the scalar type of highest precision of the same kind as the ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
233 Views
To return the string representation of a scalar dtype, use the sctype2char() method in Python Numpy. The 1st argument, if a scalar dtype, the corresponding string character is returned. If an object, sctype2char tries to infer its scalar type and then return the corresponding string character.StepsAt first, import the required library −import numpy as npThe string representation of a scalar type −for i in [np.int32, np.double, np.complex_, np.string_, np.ndarray]: print(np.sctype2char(i))Return the string representation of int types −print("The string representation of int types...") for j in [np.int16, np.int32, np.int64]: print(np.sctype2char(j))Return the string representation of float types −print("The string representation ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
141 Views
To return a description for the given data type code, use the typename() method in Python Numpy. 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 npOur array −arr = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q']To return a description for the given data type code, use the typename() method in ... Read More