Calculating aggregated variables
In the previous exercise you constructed two basetables corresponding with two snapshots, and added the target values to these basetables. In this exercise, you will learn how to add aggregated variables. You will add the sum of donations last month (December 2016 and December 2017 for the respective snapshots) to both basetables.
Diese Übung ist Teil des Kurses
Intermediate Predictive Analytics in Python
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Maximum of donations for each donor in december 2016
gifts_max_december_2016 = gifts_december_2016.____("donor_id")["amount"].____().reset_index()
gifts_max_december_2016.columns = ["donor_id", "max_amount"]
# Maximum of donations for each donor in december 2017
gifts_max_december_2017 = gifts_december_2017.____("donor_id")["amount"].____().reset_index()
gifts_max_december_2017.columns = ["donor_id", "max_amount"]