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