[Numpy-discussion] how to find out element size of flexible dtype
Sun Oct 17 20:42:39 CDT 2010
If my function receives an array with a flexible dtype such as string or unicode, how do I find out what the size (max number of elements, not number of bytes) of the datatype is?
>>> x = np.array(['a', 'b', 'cd'], (np.unicode_, 4))
The string representation of x.dtype shows that is has element size 4, so I could get the element size by parsing that, but is there a more elegant way to get this?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion