npyjs icon indicating copy to clipboard operation
npyjs copied to clipboard

Support for all numpy dtypes

Open rmorshea opened this issue 1 year ago • 3 comments

Numpy supports the following dtypes as per the docs. However npyjs only supports the following:

character description supported
'?' boolean NO
'b' (signed) byte NO
'B' unsigned byte NO
'i' (signed) integer YES
'u' unsigned integer YES
'f' floating-point YES
'c' complex-floating point NO
'm' timedelta NO
'M' datetime NO
'O' (Python) objects N/A
'S', 'a' zero-terminated bytes (not recommended) NO
'U' Unicode string NO
'V' raw data (void) NO

Would be great to add these in.

rmorshea avatar Mar 12 '24 00:03 rmorshea

Working on supporting this in #52 :)

j6k4m8 avatar Aug 27 '25 19:08 j6k4m8

Implemented unicode support in #56

sebaB003 avatar Sep 05 '25 14:09 sebaB003

Note that signed byte is equivalent to int8 and unsigned byte is equivalent to uint8:

In [1]: import numpy as np

In [2]: np.array([1, 2], dtype=np.byte)
Out[2]: array([1, 2], dtype=int8)

In [3]: np.array([1, 2], dtype='B')
Out[3]: array([1, 2], dtype=uint8)

So they are already supported in the logic

sebaB003 avatar Sep 05 '25 14:09 sebaB003