Tweeted By @TedPetrou
Try to avoid calling the apply method from a groupby object in pandas. It is one of the slowest operations you can do. To avoid, go through each line in the applied function and ask:
— Ted Petrou (@TedPetrou) February 25, 2019
Is this operation independent of the group? If so, execute it outside of the group. pic.twitter.com/6sK34m8ihE