I think you would be better off writing your class from scratch, rather than by extending numpy.ndarray
My reasons:
- Since you will be working with non-numeric indices, you are probably going to restrict yourself to 1-dimensional structures. Which means you will be completely ignoring all the multi-dimensional capabilities of
numpy.ndarrays.
numpy.ndarray comes with some restrictions such as the fact that the elements must all be of uniform byte-size. Those restrictions may not suit you.
Also, you you might want to take a look at structured arrays of numpy, as they can also be indexed with non-numeric indexes (well, in a certain limited sense, actually -- please go through the examples given there).
Just curious about your desired functionality and semantics: In numpy, if x and y are two 1d numpy arrays of the same length, you are allowed to compare them with x == y. On the other hand, if data_1 and data_2 are two of your arrays, having the same length of 3, they might still be indexed differently. data_1 might be indexed with the index values 'red', 'green', and 'blue', while data_2 might be indexed with values 'high', 'medium', 'low'. In both cases, the number of valid indices is 3, so, in a sense, both data_1 and data_2 are of the same length of 3. But then, would you consider it valid to compare them with data_1 == data_2? What about the array of booleans resulting from the comparison? Would you index the boolean array with 'red', 'green', and 'blue', or with 'high', 'medium', 'low'?