Python/이론, 기초

pandas, github에 있는 데이터 파일 가져오기

파송송 2024. 4. 8. 14:19
728x90

아래의 github에 있는  tsv(또는 csv) 파일을 가져올 것이다.

위의 파일을 눌러서 들어와서 Raw 버튼을 누른다. 

"https://raw.githubusercontent.com/google-research/google-research/master/goemotions/data/train.tsv"

 

위의 주소를 그대로 복사하여 아래 코드에 넣는다. 

 

ParserError: Error tokenizing data. C error: Expected 2 fields in line 12, saw 4

ParserError: Error tokenizing data. C error: Expected 2 fields in line 12, saw 4

위와 같은 에러가 떠서 sep='\n'을 추가하여 해결


df=pd.read_csv("https://raw.githubusercontent.com/google-research/google-research/master/goemotions/data/train.tsv", sep='\t')
df.columns = ["text", "label","eecwqtt"]
df.head(10)

728x90