Reputation: 149
Use the following command, the s.dtype
will be 'S7', what does 'S7' means?
I have Googled, but only a Japanese website with failed link
I have read the Document in numpy, no luck
>>> strings = np.array([b'cat', b'dog', b'chicken', b'horse', b'goat'])
>>> s = strings[[0,1]]
>>> s.dtype
dtype('S7')
Thanks for your help
Upvotes: 1
Views: 1223
Reputation: 61
The dtype object describes how the bytes in the fixed-size block of memory corresponding to an array item should be interpreted. It describes different aspects of the data such as:
Here, 'S7' means that the object is of type string and it's size(no. of bytes) is 7. You can confirm this by calling the 'itemsize' attribute for s.
>>>s.itemsize
7
Upvotes: 2