티스토리 뷰
문제점
data.csv 파일을 Colaboratory 에서 pd.read_csv() 로 읽었더니 한글이 깨진다.
encoding 확인
notepad++ 로 읽어서 encoding 을 확인해보니 EUC-KR 임
Jupyter lab 의 경우
- engine='python' 옵션만 주어도 문제없이 출력된다.
- 옵션을 주지않으면 에러가 발생한다.
Colaboratory 의 경우
실습용 Colaboratory 링크: https://goo.gl/1KdNKK
실습용 데이터: data.csv
Colab 에 파일 올리기
- 아래 코드를 실행하면 업로드 버튼이 생긴다.
- 로컬의 파일을 Colaboratory 에 올린다.
from google.colab import files uploaded = files.upload() # 파일 업로드 기능 실행
for fn in uploaded.keys(): # 업로드된 파일 정보 출력 print('User uploaded file "{name}" with length {length} bytes'.format( name=fn, length=len(uploaded[fn]))) |
engine='python' 옵션을 써보자
- 깨진다.
solution: euc-kr 은 euc-kr 로
Python Standard Encoding 을 보면 euc-kr 이 있다.
링크: https://docs.python.org/3/library/codecs.html#standard-encodings
encoding='euc-kr' 옵션
- 문제해결!
'google colaboratory' 카테고리의 다른 글
Colaboratory 에 이미 설치된 package 를 upgrade 하려면 (0) | 2018.08.14 |
---|---|
Colaboratory - connect your Google Drive (0) | 2018.05.21 |
Colaboratory - load file from Google Drive (3) | 2018.05.21 |
- Total
- Today
- Yesterday
- github
- websocket
- 2023
- 노션
- go
- 명상
- 중용
- API
- 클린 애자일
- OpenAI
- folklore
- 인텔리제이
- Gin
- ORM
- intellij
- pool
- Bug
- 잡학툰
- Shortcut
- 독서후기
- bun
- agile
- ChatGPT
- solid
- golang
- 영화
- notion
- strange
- postgres
- 체호프
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |