將 JSON 資料讀入記憶體
當資料以 JSON 格式儲存時,未必能直接輕鬆載入成 DataFrame。"nested_testing_scores.json" 檔案正是如此。這裡你需要先手動整理資料,才能把它存成 DataFrame。
為了幫你開始進行,pandas 已以 pd 名稱載入至工作空間。
本練習屬於課程
使用 Python 的 ETL 與 ELT
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
def extract(file_path):
# Read the JSON file into a DataFrame, orient by index
return pd.____(file_path, orient="index")
# Call the extract function, pass in the desired file_path
raw_testing_scores = ____("____")
print(raw_testing_scores.head())