Session Ready
Exercise

Calculate an event target

======= You are organising a charity event and want to predict which donors are most likely to attend this event. You organized a similar event in the past, so you can use that information to construct a predictive model. Given is a list population with unique donor ids for this basetable and a list attend_event with donors in the population that attended this past event. In this exercise you will construct a basetable with two columns: the donor_id and the target, which is 1 if the donor attended the event and 0 otherwise.

Instructions
100 XP
  • Construct a pandas dataframe basetable that has one row for each donor in population and one column donor_id with the donor's ID.
  • Add the target as a column to the basetable. The target is 1 if the donor attended the event and 0 otherwise.
  • Calculate and print the target incidence, i.e. the number of times the target is 1 divided by the number of rows in the basetable.