머신러닝

colab xlrd오류 대응

Xmobile 2022. 5. 11. 14:11

이슈 

- pandas 모듈로 엑셀파일 로드시 하기 에러발생시

import pandas as pd

raw_data = pd.read_excel('./data/teenage_mental.xls')
ImportError                               Traceback (most recent call last)
<ipython-input-4-7fe267b63e94> in <module>()
      1 import pandas as pd
      2 
----> 3 raw_data = pd.read_excel('./data/teenage_mental.xls')

4 frames
/usr/local/lib/python3.7/dist-packages/pandas/compat/_optional.py in import_optional_dependency(name, extra, errors, min_version)
    139                 return None
    140             elif errors == "raise":
--> 141                 raise ImportError(msg)
    142 
    143     return module

ImportError: Pandas requires version '1.2.0' or newer of 'xlrd' (version '1.1.0' currently installed).

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

 

방법 

하기 명령 실행후 runtime 재시작 

!pip install --upgrade xlrd