How to Create a NumPy Array with Data Type 4 Bytes Float


In this example we will show how to create a NumPy array with data type 4 bytes float in Python.

Source Code

import numpy as np

n = np.array([1, 2, 3, 4, 5, 6], dtype='f4')

print(n)
print(n.dtype)

Output:

[1. 2. 3. 4. 5. 6.]
float32
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments