Question 9 of 10Pro Only
Why are vectorized operations faster than loops in Pandas and NumPy? How would you refactor a loop-based solution to use vectorization?
Sample answer preview
Vectorization is one of the most important concepts for writing efficient data science code in Python. Understanding why it is faster and how to apply it can dramatically improve performance. Vectorized operations are faster for several reasons.
vectorizationperformanceNumPybroadcastingcontiguous memoryitertuples