1. Learn
  2. /
  3. Courses
  4. /
  5. Intermediate Predictive Analytics in Python

Connected

Exercise

Available data

Assume that you want to construct a model that predicts whether someone will donate in a certain year. The timeline to construct the basetable has 2017 as target period, this means that the target is based on donations made in 2017, and that the predictive variables are based on donations made before 2017. All donations are given in a pandas dataframe gifts with three columns: the donor id, the donation date and the amount donated. In this exercise you will learn to construct a new pandas dataframe that excludes donations made in 2017 or later.

Instructions

100 XP
  • Enter the start date of the target period.
  • Construct a pandas dataframe gifts_before_2017 that only contains gifts made before 2017 (exclusive).
  • Count the donations in gifts_before_2017 and print it to the console.