스터디/트러블 슈팅

[Python] pandas에서 엑셀 파일을 불러올 때 발생한 ImportError

skyggg3 2022. 8. 17. 12:58
수정 전
import pandas as pd
df = pd.read_excel('car.xlsx')

 

에러 원인

 

에러 종류 ImportError
모듈에러
에러 메시지
ImportError: Missing optional dependency 'openpyxl'. Use pip or conda to install openpyxl

발생 이유 판다스로 엑셀 파일을 불러오는 과정에서 openpyxl 모듈이 없으면 의존성 문제가 발생한다.
해결 방법 판다스에서 엑셀 파일을 불러오기 위해서는 openpyxl이 필요하다.
pip install openpyxl을 한 후 read_excel 재실행

 

 

수정 후
!pip install openpyxl
import pandas as pd
df = pd.read_excel('car.xlsx')