menu_book Course Curriculum (NumPy) expand_more
Array Creation
Shape & Indexing
Broadcasting & Vectorization
Aggregation & Statistics
Combining & Splitting
vectorize() trade-offs
Learn vectorize() trade-offs in NumPy with a dedicated explanation, a concept-specific example, practical cautions, and a mastery check.
12 min read
•
Intermediate
numpy-024.py
python
import numpy as np
def label(x): return 'even' if x % 2 == 0 else 'odd'
wrapped = np.vectorize(label, otypes=[str])
print(wrapped(np.arange(5)))
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content