The difference between the agg () function and the Apply () function in pandas

Source: Internet
Author: User

If the call to the custom top_n takes the agg function, then the reported error will be

Illustrates a problem, using the AGG function to call Top_n, it is trying to use top_n for each packet aggregation, but the role of Top_n is a sort, not aggregation, so will definitely error

So in this case, you can only use the Apply function, not the AGG function, the function called within the AGG function can only be used to aggregate the grouping.

Beginners, personal understanding, if there are errors, hope understanding

The difference between the agg () function and the Apply () function in pandas

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.