ComenzarEmpieza gratis

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 ejercicio forma parte del curso

Intermediate Predictive Analytics in Python

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

# 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 y ejecutar código