아미(아름다운미소)

python pandas 데이터를 excel 파일생성시 한글깨짐문제 해결 본문

랭귀지/PYTHON

python pandas 데이터를 excel 파일생성시 한글깨짐문제 해결

유키공 2019. 1. 14. 14:19

python pandas 데이터를 excel 파일생성시 한글깨짐문제 해결

df.to_csv("파일명")
위의 메소드는 excel 에서 읽으면 깨지는 현상이 발생합니다.
encoding 을 utf-8 이나 다른 걸로 해도 윈도우 엑셀에서 읽으려고 하면 읽히지 않고 한글이 깨집니다. 

해결방법
df.to_excel('foo.xlsx', sheet_name='sheet1')


Comments