開始使用免費開始

載入 DataFrame

我們仍在全力偵辦金毛獵犬 Bayes 的綁架案。前面我們利用在案發現場看到的車牌號碼,把嫌疑人縮小到以下幾位:

  • Fred Frequentist
  • Ronald Aylmer Fisher
  • Gertrude Cox
  • Kirstine Smith

我們已經取得這四位嫌疑人的信用卡消費紀錄。也許有人在案發前有可疑的消費?

這些紀錄存放在名為 "credit_records.csv" 的 CSV 檔案中。

本練習屬於課程

Python 的資料科學入門

檢視課程

練習說明

  • 以別名 pd 匯入 pandas 模組。
  • "credit_records.csv" 載入為名為 credit_records 的 DataFrame。
  • 使用 .head() 方法顯示 credit_records 的前 5 列。

動手互動練習

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

# Import pandas under the alias pd
____

# Load the CSV "credit_records.csv"
credit_records = ____

# Display the first five rows of credit_records using the .head() method
print(____)
編輯並執行程式碼