ComeçarComece de graça

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.

Este exercício faz parte do curso

Intermediate Predictive Analytics in Python

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# 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"]
Editar e executar o código