Numpy `logical_or` for more than two arguments

后端 未结 7 1013
庸人自扰
庸人自扰 2020-11-22 09:33

Numpy\'s logical_or function takes no more than two arrays to compare. How can I find the union of more than two arrays? (The same question could be asked wit

7条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 09:56

    Building on abarnert's answer for n-dimensional case:

    TL;DR: np.logical_or.reduce(np.array(list))

提交回复
热议问题