More Aggregations

Explore the `.transform` and the `.filter` methods of a groupby object.

Aggregations while keeping rows

Let’s assume we’re still looking at the JetBrains dataset, and we want to add a new column, the count of responses from a country. One way to do that would be to create a pivot table (or groupby) of the count of responses for each country and then merge that data back into the original DataFrame. However, if we use the transform method following groupby, we get the aggregation, but they’re not collapsed. The result is in terms ...