76.9 Performance: Avoiding Loops with Vectorized Operations
Right, let’s talk about performance. You’ve probably written a for loop to iterate over a DataFrame. It feels intuitive, right? You’re a smart person; you know how to loop over a list. So you do the same thing with your data. I need you to do something for me. Open a new notebook. Create a DataFrame with a few million rows. Now write a standard Python forloop to create a new column. I’ll wait.