探索基礎表
在開始建立模型之前,先了解你手上的資料很重要。這個練習中,你會學到如何從給定的基礎表(basetable)取得母體大小、target 數量,以及 target 發生率。
本練習屬於課程
Python 預測分析入門
練習說明
- 基礎表已載入為 pandas 物件
basetable。將列數指定給變數population_size,並印出它。 - 將等於 1 的 target 數量指定給變數
targets_count,並印出它。 - 印出 target 發生率,也就是
targets_count與population_size的比值。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Assign the number of rows in the basetable to the variable 'population_size'.
population_size = ____(____)
# Print the population size.
print(____)
# Assign the number of targets to the variable 'targets_count'.
targets_count = ____(____[____])
# Print the number of targets.
print(____)
# Print the target incidence.
print(____ / ____)