pandas dataframe을 csv 형태로, utf-8로 encoding하여 저장하면 엑셀파일에서 깨지는 문제가 생겼다.
df.to_csv('file_name.csv',encoding='utf-8')
->한글 깨짐
해결책은 다음과 같다.
df.to_csv('file_name.csv',encoding='utf-8-sig')
utf-8 대신에,utf-8-sig를 이용해서 인코딩하면 된다.
MAC 환경
Python 3.6.4 :: Anaconda custom (64-bit)
참고사이트
'Computer > Error' 카테고리의 다른 글
TypeError: Cannot read property 'prototype' of undefined (0) | 2022.02.03 |
---|---|
Mac 환경 psycopg2 설치 시 에러나는 경우 (0) | 2021.05.13 |
Wamp 설치 후 서버 동작확인 문제 (0) | 2021.04.06 |
[Github] binary file conflict problem (0) | 2021.04.03 |
[zsh설정] zsh-syntax-highlighting, history-substring-search 설정 Error 해결방법 (0) | 2021.03.22 |