[Numpy-discussion] simple select(): for anyone with too many conditions for np.select(), or scalar-valued choicelists.

Graeme B. Bell grb at skogoglandskap.no
Fri Jul 5 14:29:23 EDT 2013


I've made a drop-in replacement for select() which works with large numbers of conditions, and which consistently outperforms numpy.select for my use case (scalar condlist). 
It fixes a couple of other issues too, and (I feel) improves the internal documentation of the code. I have included benchmarks and some tests.


    https://github.com/gbb/numpy-simple-select


The numpy dev team are welcome to include all or part of this code into the main numpy distribution or it can be kept separate or ignored if they prefer. :-)

If you need more than 30 ndarrays in your 'condlist', or if you have an all-scalar choicelist, I think you will find this code particularly interesting. 

Formal test coverage is incomplete, but I think this is still going to be quite useful for some people.

Have a nice weekend,

Graeme 


More information about the NumPy-Discussion mailing list