AI engineering glossary · NumPy pandas visualization
What is np.where?
np.where: A NumPy function that chooses between two values for each element depending on a condition array. With one argument only, it instead returns the positions where the condition is true. It is a vectorised replacement for an if-else inside a loop.
np.where: an example
np.where(marks >= 40, 'pass', 'fail') labels every mark in an array as pass or fail in one step.
Related terms
More NumPy pandas visualization terms
- np.zeros and np.ones
- NumPy
- NumPy integer overflow
- Overplotting
- Pair plot
- Pandas
- pandas concat
- pandas groupby
Where you learn it
np.where is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.