2

I'm sorry for I'm not good at English.

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

I encountered this error in the process of filtering data from csv file:

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'

my question: Output: genre film- quantity <.csv or .xls>. Thank you every one! ps: data file: https://docs.google.com/spreadsheets/d/1omAVC38sTCcc6MK1EvIW-gTbCROuLhQlqJcnPv35o3I/edit#gid=1415354227

Tin Nguyen
  • 21
  • 3

0 Answers0