{"id":372,"date":"2022-12-26T00:00:00","date_gmt":"2022-12-26T00:00:00","guid":{"rendered":"https:\/\/tac.debuzzify.com\/?p=372"},"modified":"2023-06-20T09:35:39","modified_gmt":"2023-06-20T09:35:39","slug":"agg-method-vs-apply-pandas","status":"publish","type":"post","link":"https:\/\/www.the-analytics.club\/agg-method-vs-apply-pandas\/","title":{"rendered":"Use agg() Method Over apply() To Accumulate Pandas Dataframes Faster."},"content":{"rendered":"\n
Data scientists extensively use Pandas for data wrangling. Aggregation is a common task in data wrangling. But in Pandas, there is more than one way to do this.<\/p>\n\n\n\n
One way is to use the For a one-time analysis, this isn’t a big deal. The difference is minuscule for smaller datasets.<\/p>\n\n\n\n Yet, when we work on a larger dataset, we must know the impact, especially if the operation is supposed to run repeatedly, as in a data pipeline.<\/p>\n\n\n\n\n\n This post discusses the difference and analyses its impact on an ordinary computer. I hope this will help you find the best option for your recurring data tasks.<\/p>\n\n\n\n Talking about Pandas, here are the top resources to boost your data-wrangling skills.<\/p>\n\n\n\n [Book]<\/b> Python for Data Analysis: Data Wrangling with pandas, NumPy, and Jupyter<\/b> 3rd Edition<\/b><\/a> by<\/b> Wes McKinney<\/b><\/a> <\/b>The above links are carefully curated affiliate links. I earn a commission for qualified purchases at no extra cost to you. But it never affects what we pick.<\/p>\n<\/blockquote>\n\n\n\napply<\/code><\/a> method (or
map<\/code><\/a> if it’s a series) on a dataframe. This is what I usually do. But the
.<\/code>
agg<\/code><\/a> method is another option I often neglect.<\/p>\n\n\n\n
\n
[Online Course]<\/b> Data Analysis with Pandas and Python by Boris Paskhaver<\/b><\/a><\/b> <\/b><\/p>\n\n\n\n