First page Back Continue Last page Overview Graphics

Arrays With Various Data Types

>>> import numpy as np

>>> b = np.array([True, False, False, True])

>>> b.dtype

dtype('bool')

>>> c = np.array([1+2j, 2-1j, 2+4*1j])

>>> c.dtype

dtype('complex128')

>>> f = np.array(['one', 'two', 'three', 'four'])

>>> f.dtype

dtype('<U5')

>>> f = np.array([b'one', b'two', b'three', b'four'])

>>> f.dtype

dtype('S5')

>>>

unicode strings with maximal 5 characters

ascii (bytes) strings with maximal 5 characters