BaşlayınÜcretsiz Başlayın

Adding living place

Finally, you want to add the living place of the donors to the basetable. The living places of the donors are given in living_places where the living place for each donor is given together with the start and end valid date of that living place. Keep in mind the following timeline that is used to construct the basetable:

Bu egzersiz

Intermediate Predictive Analytics in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Fill out the reference date.
  • Create a new pandas dataframe living_places_reference_date that contains the living places of the donors at the reference date.
  • Merge this new dataframe with the basetable.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Reference date
reference_date = datetime.date(____, ____, ____)

# Select living place reference date
living_places_reference_date = living_places[(living_places["____"] <= ____) & 
                                            (living_places["____"] > ____)]

# Add living place to the basetable
basetable = pd.____(____, living_places_reference_date[["____", "____"]], on="donor_ID")
Kodu Düzenle ve Çalıştır