Saved Bookmarks
| 1. |
How do you find the data type of the elements stored in the NumPy arrays? |
|
Answer» NumPy supports the following datatypes:
arr1 = np.array([1, 2, 3, 4]) arr2 = np.array(['I', 'love', 'Interviewbit']) # Stored as Unicode characters with length of characters ranging from 1 to 12 arr3 = np.array([1, 2, 3, 4], dtype='S') # Creating numpy array of defined type string print(arr1.dtype) print(arr2.dtype) print(arr3.dtype) The output will be: int64<U12 |S1 |
|