티스토리 뷰
문제점
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
- 체호프
- clean agile
- agile
- 티스토리챌린지
- 클린 애자일
- 오블완
- websocket
- strange
- ChatGPT
- MCP
- postgres
- 독서후기
- backend
- 잡학툰
- bun
- notion
- OpenAI
- 독서
- go
- API
- Echo
- 인텔리제이
- github
- Gin
- middleware
- gocore
- solid
- intellij
- golang
- 영화
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |