파이썬
[Python] If using all scalar values, you must pass an index
필경이야
2022. 9. 20. 13:14
[Python] If using all scalar values, you must pass an index
json 배열이 아닌 단순 json을 dataframe으로 변환할 경우 해당 오류를 반환한다.
(1) 데이터 설정시 인덱스값을 설정해준다
df = pd.DataFrame({'col1': 1,
'col2': 2},
index = [0])
(2) 단순 json을 배열안에 넣어서 dataframe을 선언한다.
df = pd.DataFrame([{'col1': 1,
'col2': 2}])