通过xlrd过滤数据csv文件

时间:2017-10-02 11:46:46

标签: python excel xlrd

我很抱歉我不擅长英语。

import xlrd
book = xlrd.open_workbook('movie_metadata.csv')
first_sheet = book.sheet_by_index(0)

我在从csv文件过滤数据的过程中遇到了这个错误:

Traceback (most recent call last):
File "E:\PTUD_test\PTUD_test\test.py", line 3, in <module>
book = xlrd.open_workbook('movie_metadata.csv')
File "C:\Python27\lib\site-packages\xlrd\__init__.py", line 162, in 
open_workbook
ragged_rows=ragged_rows,
File "C:\Python27\lib\site-packages\xlrd\book.py", line 91, in 
open_workbook_xls
biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
File "C:\Python27\lib\site-packages\xlrd\book.py", line 1271, in getbof
bof_error('Expected BOF record; found %r' % self.mem[savpos:savpos+8])
File "C:\Python27\lib\site-packages\xlrd\book.py", line 1265, in bof_error
raise XLRDError('Unsupported format, or corrupt file: ' + msg)
XLRDError: Unsupported format, or corrupt file: Expected BOF record; found 
'color,di'

我的问题:输出:流派电影 - 数量&lt; .csv或.xls&gt;。 谢谢大家! ps:数据文件:https://docs.google.com/spreadsheets/d/1omAVC38sTCcc6MK1EvIW-gTbCROuLhQlqJcnPv35o3I/edit#gid=1415354227

0 个答案:

没有答案