開始使用免費開始

用 .corr() 分析變數

有一份針對 17 名嬰兒的問卷 birth_survey,用來研究以週數為單位量測的出生妊娠週數 birth_age 與以公克為單位量測的出生體重 birth_weight 之間的關聯。

在這個練習中,你將計算出生週數與出生體重之間的關係。

pandas 已替你載入為 pd

本練習屬於課程

使用 Python 分析問卷資料

檢視課程

練習說明

  • 使用函式找出問卷中變數 birth_agebirth_weight 的相關性。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Find the correlation between variables present in the survey
cor = birth_survey.____.____(birth_survey.____)
print(cor)
編輯並執行程式碼