xlrd.biffh.XLRDError:不支持的格式,或文件损坏:预期的BOF记录

时间:2019-09-20 09:53:43

标签: pandas pandas-groupby

我是熊猫图书馆的新手。我用它来读取我的Excel文件;

def read_deliveryfile():
    delivery_path = '/Users/ratha/PycharmProjects/DataLoader/data/deliveries'
    files = os.listdir(delivery_path)
    df = pd.DataFrame()

    for f in files:
        data = pd.read_excel(os.path.join(delivery_path, f), sheet_name='Refined', skiprows=[0])
        df = df.append(data)
    x = df.groupby(['Ship-To Party', 'Material'])
    print(x)

我得到的错误;

File "/Users/ratha/PycharmProjects/DataLoader/DataProcessor.py", line 15, in read_deliveryfile
    data = pd.read_excel(os.path.join(delivery_path, f), sheet_name='Refined', skiprows=[0])
...
  File "/Users/ratha/PycharmProjects/venv3bploader/lib/python3.6/site-packages/xlrd/book.py", line 1272, in bof_error
    raise XLRDError('Unsupported format, or corrupt file: ' + msg)
xlrd.biffh.XLRDError: Unsupported format, or corrupt file: Expected BOF record; found b'\x00\x00\x00\x01Bud1'

我的xlrd版本是1.2.0; 我该如何克服?

0 个答案:

没有答案