python - How to convert from a NumPy data type to a custom data type? -




i have defined new numeric data type in python using python's data model. convert existing numpy arrays existing data types custom data type. understand numpy's astype method converts 1 data type another, based on understanding, can convert between built-in data types.

in contrast answer provided here, data type not based on built-in data types , has it's own addition, multiplication, bit-wise operations, etc., cannot use np.dtype define data type. in other words, following solution not work:

kerneldt = np.dtype([('myintname', np.int32), ('myfloats', np.float64, 9)]) arr = np.empty(dims, dtype=kerneldt) 

is there way convert between built-in data type , custom data type , vice versa?

this isn't possible. there plans allow custom dtypes in numpy in future.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -