Pandas read json ValueError : Protocol not known
Aug 23 2020
이 코드를 얼마 전에 실행했는데 작동했지만 이제 ValueError : 프로토콜을 알 수 없습니다. 누구든지 도울 수 있습니다. 감사.
import json
temp = json.dumps([status._json for status in tweet]) #create JSON
newdf = pd.read_json(temp, orient='records')
답변
3 HenriqueBrisola Aug 25 2020 at 15:03
이 문제를 디버깅 할 수있는 한 pandas 업데이트로 인해 발생합니다. 1.1.0 업데이트는 read_json 함수에서 몇 가지 사항을 변경했습니다.
pandas 버전을 1.0.5로 설정할 때 코드가 작동하도록 만들 수 있습니다.
https://pandas.pydata.org/docs/whatsnew/v1.1.0.html
6 ehabets Aug 30 2020 at 07:39
제 경우의 해결책은 StringIO다음과 같이 구성되었습니다 .
from io import StringIO
newdf = pd.read_json(StringIO(temp))
pd.read_jsonPandas 1.1에서 더 이상 간단한 문자열을 받아들이지 않는 것처럼 보입니다 .