探索基表
在开始构建模型之前,理解您所使用的数据非常重要。本练习将带您学习如何从给定的基表中获取总体规模、目标数量以及目标发生率。
本练习是课程的一部分
Python 预测分析入门
练习说明
- 基表已加载为 pandas 对象
basetable。将行数赋给变量population_size并打印。 - 将等于 1 的目标数量赋给变量
targets_count并打印。 - 打印目标发生率,即
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(____ / ____)