HomeAIStage Up Your Pandas Sport with These 15 Hidden Gems | by...

Stage Up Your Pandas Sport with These 15 Hidden Gems | by Eryk Lewinson | Jan, 2024


To make sure you can observe alongside, we’re utilizing pandas 2.2.0, which is the newest model out there on the time of writing this text.

You’re most likely already conversant in performing aggregations in pandas utilizing strategies akin to sum or min. You could have additionally most likely used these strategies together with groupby. Due to this fact, it won’t come as a shock that the agg technique is used to carry out a number of aggregations on a DataFrame. What’s attention-grabbing is that we will use agg in just a few methods, relying on the syntax we use. Let’s illustrate this with some examples.

By passing a dictionary to the agg technique, we point out which aggregations (sum, imply, max, and many others.) we wish to calculate for every column of the DataFrame. The keys of the dictionary symbolize the columns on which we wish to carry out the aggregations, whereas the values symbolize the operations we wish to execute.



Supply hyperlink

latest articles

explore more