2
1

More than 3 years have passed since last update.

Pythonでread_excel()を記述するとエラーになる件

Last updated at Posted at 2021-02-27

Widnws10 Pro
Python 3.9

Pythonでエクセルを操作してするコードを書いた。
以下のエラーが発生した
```

 raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
xlrd.biffh.XLRDError: Excel xlsx file; not supported

pandas+xlrdでxlsxを開こうとするとxlrd.biffh.XLRDError: Excel xlsx file; not supportedのエラーが出る
を参考に以下のコマンドを実行してインストールした。


pip install xlrd==1.2.0

すると、今度はエラーが変わった。

AttributeError: 'ElementTree' object has no attribute 'getiterator'

Pyhon 3.9 で pandasでread_excel()すると、AttributeError: 'ElementTree' object has no attribute 'getiterator'
を参考にして


df_order = pd.read_excel(filepath)から
pd.read_excel(filepath,engine="openpyxl")に修正

無事コードが通った。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1