I just started learning NumPy, so I'm still a bit dazed with all of its ins and outs. I'm learning how to create arrays with specific data types. I'm a bit confused with this:
When I create an array of int32 data type, it shows just that:
a = np.zeros((2, 3), dtype=np.int32)
print(a)
print(a.dtype)
The print statement shows: int32
When I create an array of float data type, it shows just that:
a = np.array([1, 2, 3, 4], dtype=np.float)
print(a)
print(a.dtype)
The print statement shows: float64
However, when I create an array of data type string, it doesn't have a similar output:
a = np.array([1,2,3,4,5,6], dtype=np.string_)
print(a)
print(a.dtype)
The print statement shows:
[b'1' b'2' b'3' b'4' b'5' b'6']
|S1
Why? What does it mean? Also, why can't I choose dtype=np.string? Why do I need the underscore dtype=np.string_?