In this example we will show how to create a NumPy array with data type string in Python.
Source Code
import numpy as np
n = np.array([1, 2, 3, 4, 5, 6], dtype='S')
print(n)
print(n.dtype)
Output:
[b'1' b'2' b'3' b'4' b'5' b'6']
|S1
In this example we will show how to create a NumPy array with data type string in Python.
import numpy as np
n = np.array([1, 2, 3, 4, 5, 6], dtype='S')
print(n)
print(n.dtype)
Output:
[b'1' b'2' b'3' b'4' b'5' b'6']
|S1