I have this code:
>>> d = np.dtype([("pos", np.float64, 3)])
>>> d[0].kind
'V'
Why does it return 'V'
instead of 'f'
? In the full code, I need to know if the field corresponds to an integer, float, string...
d[0].kind
does not return 'f'
because it is not a floating-point dtype: it is a structured dtype with a floating point base.
There are several other attributes of structured dtypes that you might be able to inspect depending on your particular goal. For example:
>>> d[0].base
dtype('float64')
>>> d[0].subdtype[0].kind
'f'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With