본문 바로가기

카테고리 없음

[오류해결] 판다스 엑셀 READ excel error

반응형

df = pd.read_excel(fname,engine='xlrd')

xls 를 하나 열려고 하는데, 잘 안열리고 에러가 나고 난리...였다.

XLRDError: Unsupported format, or corrupt file: Expected BOF record; found b'\r\n\t\t\t<sc'

bof_error('Expected BOF record; found %r' % self.mem[savpos:savpos+8])
raise ValueError(
    367         "Engine should not be specified when passing "
    368         "an ExcelFile - ExcelFile already has the engine set"
    369     )

 

그래서 pywin32도 깔아보고 엑셀도 열어서 xlsx로 재저장했더니, 회사 DRM 걸리고 --;; openpyxl 등등 별걸 다 깔아서 열어봐도 결국은 pandas 의 함수로 해결?되어따.
스택오버플로우에서 만난 귀인이 던저쥰 코드로 해결하였다 ㅋㅋㅋ

(Thumbs up 눌러 줬다.ㅋ)

 

df = pd.read_html(fname)
df[0]

 

반응형