simple select(): for anyone with too many conditions for np.select(), or scalar-valued choicelists.
![](https://secure.gravatar.com/avatar/05310d981d2f76e806e2b08fc4337164.jpg?s=120&d=mm&r=g)
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
participants (1)
-
Graeme B. Bell