Python으로 하는 ETL과 ELT
Jake Roach
Data Engineer

생성되고 활용되는 데이터 대부분은 비정형 데이터입니다

API (Application Programming Interface)
$$

JSON (JavaScript Object Notation)
dict(딕셔너리)와 형태와 느낌이 유사함{
"key": "value",
...
"open": 0.121875
}
{
"timestamps": [863703000, 863789400, ...],
"open": [0.121875, 0.098438, ...],
"close": [...],
"volume": [...]
}
.read_json() 함수를 사용하세요
# Read in a JSON file in the format above
raw_stock_data = pd.read_json("raw_stock_data.json", orient="columns")
데이터가 항상 DataFrame으로 바로 변환 가능한 형태는 아닙니다
{
"863703000": {
"volume": 1443120000,
"price": {
"close": 0.09791,
"open": 0.12187
}
},
"863789400": {
...
}, ...
}
import json
with open("raw_stock_data.json", "r") as file:
# Load the file into a dictionary
raw_stock_data = json.load(file)
# Confirm the type of the raw_stock_data variable
print(type(raw_stock_data))
<class 'dict'>
Python으로 하는 ETL과 ELT