母體

Python 中級預測分析

Nele Verbiest Ph. D.

Senior Data Scientist @PythonPredictions

母體需求

母體需符合目標條件:

  • 有可用地址
  • 隱私設定
  • …
Python 中級預測分析

時間線相符的母體:年齡(1)

Python 中級預測分析

時間線相符的母體:年齡(2)

Python 中級預測分析

時間線相符的母體:捐款(1)

Python 中級預測分析

時間線相符的母體:捐款(2)

Python 中級預測分析

時間線相符的母體:捐款(3)

Python 中級預測分析

Python 中的母體

donations_2016 = gifts[gifts["date"].dt.year==2016]
donors_include = set(donations_2016["id"])
print(donors_include)
{1002,3043,4934, ...}
donations_2017 = gifts[(gifts["date"].dt.year==2017) 
                       & (gifts["date"].dt.month<5)]
donors_exclude = set(donations_2017["id"])
print(donors_exclude)
{2451,3047,4474, ...}
population = donors_include.difference(donors_exclude)
Python 中級預測分析

一起來練習吧!

Python 中級預測分析

Preparing Video For Download...