始める無料で始める

平均発生率の計算

Predictor insight graph の表で最も重要な列は、ターゲットの発生率(target incidence)です。この列には、各グループにおけるターゲットの平均値が表示されます。

この演習はコースの一部です

Pythonで学ぶ予測分析入門

コースを見る

演習の手順

  • 変数 targetincome のみを含む DataFrame basetable_income を作成します。
  • この DataFrame を income でグループ化します。
  • income の各グループについて、ターゲットの平均発生率を計算します。

実践的なインタラクティブ演習

このサンプルコードを完成させて、この演習に挑戦してみましょう。

# Select the income and target columns
basetable_income = basetable[["____","____"]]

# Group basetable_income by income
groups = basetable_income.____("____")

# Calculate the target incidence and print the result
incidence = groups["____"].agg(Incidence = '____').reset_index()
print(incidence)
コードを編集して実行