Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • While you can apply tests like this to elements of x, you can't apply them to x itself. myarray>6 is a boolean array, which doesn't work in an if context (and not in an and or or). Another caution; don't use == np.nan. Commented Feb 13, 2019 at 8:15
  • Please see my EDITED question. Thanks Commented Feb 13, 2019 at 8:29
  • 1
    See this answer. Commented Feb 13, 2019 at 8:46
  • Thanks. I've tried this nested np.where before and it did not work, but now I've copy-paste the syntax from the answer you linked and changed it accordingly and it seems to work. In case I have multiple large arrays, is there a more efficient way to achieve that? Commented Feb 13, 2019 at 9:53
  • It depends on your use case. Without further knowledge, I would say that you can build your conditions and choices also with multiple arrays. Commented Feb 13, 2019 at 10:28