How to Check Data Type of a NumPy Array


In this example we will show how to check the data type of a NumPy array in Python.

Source Code

import numpy as np

a = np.array([1, 2, 3, 4, 5, 6])
print(a.dtype)

b = np.array(['a', 'b', 'c', 'python'])
print(b.dtype)

Output:

int32
<U6
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments