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