Is looping over a Pandas DataFrame good practice, what should you check first, and what are the alternatives?
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: medium
Interview Round: Other
Overview: Asks whether looping over the rows of a Pandas DataFrame is good practice, what to check before writing such a loop, and which faster approaches to use instead. Tests knowledge of vectorization, iterrows versus itertuples, dtype pitfalls, apply, groupby and map.