0
xlsをpythonでpandasを使ってcsvファイルに変換しようとしています。しかし、私は 'XLRDErrorのような次のエラーが発生しています:Sheet1'> 'という名前の<シートはありません。シート名を確認しましたが、上記と同じですが、このエラーを修正する方法はありません。以下の私のコードを見つけてください。XLRDError:シート名が<'Sheet1'>で、Pythonで
CODE:
def xls_2_csv():
import pandas as pd
data_xls = pd.read_excel(r'c:\delivery\file1.xls','Sheet1', index_col=None)
data_xls.to_csv(r'C:\test\file1.csv', encoding='utf-8',index=None)
xls_2_csv()
このエラーを解決するために私を助けてください。前もって感謝します。
複数のシートがありますか? 'sheet1' - ' data_xls = pd.read_excel(r'c:\ delivery \ file1.xls '、index_col = None) ' – jezrael
パンダのどのバージョンを使用すればいいですか? 'print pd.show_versions()' – jezrael
@jezrael:返信ありがとう、私はパンダを使用しています:0.14.1。シートが1枚しかなく、シート名を削除すると次のエラーが表示されます。 "***いいえCODEPAGEレコード、encoding_overrideなし: 'ascii'を使用します。 – user3827728