Can anyone help me to understand the meanings of numpy dtypes? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone help me to understand the meanings of numpy dtypes?

Can somebody tell me the meanings of int64, float64, <U6 & <U21? 1) x = np.array([1,2,3,4,5] print(x.dtype) = int64 2) y = np.array([1.1,2.2,3.3,4.4,5.5] print(y.dtype) = float64 3) z = np.array(['xyz','abc'] print(z.dtype) = <U6 4) x1 = np.array([1,2,3,'jklm'] print(x1.dtype) = <U21

25th Sep 2022, 6:43 AM
S S
2 Answers
+ 5
Sultan Shaikh , you can use the numpy tutorial to get a better insight of these data types. scroll down to get some samples and see the descriptions. https://numpy.org/doc/stable/reference/arrays.dtypes.html
25th Sep 2022, 11:07 AM
Lothar
Lothar - avatar
+ 2
The operating system allocates memory and chooses what will be stored in the allocated memory based on the data type of the variable.
25th Sep 2022, 8:27 AM
Solo
Solo - avatar