Session Ready
Exercise

Calculate an aggregated target

Assume you want to construct a predictive model that predicts which donors are most likely to donate more than 50 euro in a certain month.

Given is a basetable basetable that already has one row for each donor in the population, the column donor_id represents the donor. The timeline indicates that the target should be 1 if the donor has donated more than 50 euro in January 2017 and 0 else.

The pandas dataframe gifts_201701 contains all donations in January 2017. In this exercise you will add the target column to the basetable.

Instructions
100 XP
  • Construct gifts_summed, which has for each donor in gifts_201701 the sum of donations.
  • Derive from gifts_summed a list targets with donors that donated more than 50 Euro in the target period.
  • Add the target to the basetable.
  • Calculate and print the target incidence.