w3resource

NumPy Data type: typename() function

numpy.typename() function

The typename() function is used to get a description for the given data type code.

Version: 1.15.0

Syntax:

numpy.typename(char)

Parameter:

Name Description Required /
Optional
char : str Data type code. Required

Return value:

out : str - Description of the input data type code.

Example: numpy.typename() function

>>> import numpy as np
>>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q',
	     'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q']
>>> for typechar in typechars:
	print(typechar, ' : ', np.typename(typechar))
	
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

Python - NumPy Code Editor:

Previous: find_common_type()
Next: sctype2char()



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/numpy/data-type-routines/typename.php