
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Return a description for the given data type code in Python
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.
Steps
At first, import the required library −
import numpy as np
Our 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 Python Numpy. The 1st argument is the Data type code −
for i in arr: print(i, ' : ', np.typename(i))
Example
import numpy as np # declaring 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 Python Numpy # The 1st argument is the Data type code for i in arr: print(i, ' : ', np.typename(i))
Output
S1 : character ? : bool B : unsigned char D : complex double precision G : complex long double precision F : complex single precision I : unsigned integer H : unsigned short L : unsigned long integer O : object Q : unsigned long long integer S : string U : unicode V : void b : signed char d : double precision g : long precision f : single precision i : integer h : short l : long integer q : long long integer
- Related Articles
- Python Pandas - Return the rule code applied on the given DateOffset object
- Python Pandas - Return the rule code applied on the given BusinessDay object
- Python Pandas - Return the rule code applied on the given BusinessHour object
- Python Pandas - Return the rule code applied on the given CustomBusinessDay object
- Python Pandas - Return the rule code applied on the given CustomBusinessHour object
- Determine whether the given object represents a scalar data-type in Python
- Change data type of given numpy array in Python
- Program to convert gray code for a given number in python
- Return the data type with the smallest size and scalar kind to which both the given types be safely cast in Python
- What are the methods for Data Generalization and Concept Description?
- Return a new array of given shape filled with ones and also set the desired data-type in Numpy
- Specify a return format for data in MongoDB
- Number Data Type in Python
- String Data Type in Python
- List Data Type in Python

Advertisements