将 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())