1. Home
  2. Data Science
  3. NumPy
  4. What does the np.where() function with three arguments do…

Added 25 Feb 2024

What does the np.where() function with three arguments do in NumPy?

  1. Returns the indices of elements that satisfy a condition
  2. Replaces elements in an array based on a condition Correct answer
  3. Combines arrays based on a condition
  4. Computes the histogram of elements in an array

Correct answer

B. Replaces elements in an array based on a condition

18 views

MCQSEXAM

Explanation

When np.where() is used with three arguments, it returns elements from one of two input arrays based on a condition. If the condition is True, it selects elements from the first array; otherwise, it selects elements from the second array.

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More NumPy MCQs

Practise all NumPy MCQs

Similar MCQs