Hi folks,

Apologies if this is documented somewhere, but I haven't been able to find it. 
I've read through NEP-42 [1] and skimmed NEP-41 [2], but I'm not sure:

(a) at what point of implementation we are, and
(b) if it's pretty much done, *how* to define a custom categorical dtype.

In my use case, I'd need a dtype that is implemented as some int scalar where 
only certain values are allowed, ie the NumPy equivalent of:

class Label(Enum)
    CAR = 1
    DOG = 45
    NULL = 255

But with the ability to specify that I only need a uint8 in this case.

Is that possible today using Python (no C/Cython) and if so, is there some 
documentation or user example or StackOverflow answer that shows how to do 
this? If not, is it a design goal of the NEPs to allow such a thing? (I can be 
patient 😂)

Thank you!

Juan.

[1]: https://numpy.org/neps/nep-0042-new-dtypes.html
[2]: https://numpy.org/neps/nep-0041-improved-dtype-support.html
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to