...

/

Looping and Aggregation

Looping and Aggregation

Learn about looping and aggregation methods of DataFrame.

We'll cover the following...

Often we want to apply operations over items in a DataFrame. We may want to use looping, the apply method, or an aggregation method to do this.

For loops

We can use a for loop with a DataFrame, though we generally want to avoid for loops when doing numerical manipulation. Whenever there is a for loop with some pandas code, it means that it’s a slow operation, and we won’t be able to take advantage of the vectorization that speeds up ...