直接将XLSX文件读取为dataframe。直接在python中
我需要帮助才能读取RAR PACK中存在的XLSX文件。我正在使用以下代码,但是会出现错误。有什么更好的读取/提取文件的方法吗?
rar = glob.glob(INPATH + "*xyz*.rar*")
rf = rarfile.RarFile(rar[0])
for f in rf.infolist():
print(f.filename, f.file_size)
df = pd.read_excel(rf.read(f))
rarfile.rarcannotexec:找不到工作工具
I need help to read xlsx file present inside rar pack. I am using below code, however get an error. Is there any better way to read/extract file?
rar = glob.glob(INPATH + "*xyz*.rar*")
rf = rarfile.RarFile(rar[0])
for f in rf.infolist():
print(f.filename, f.file_size)
df = pd.read_excel(rf.read(f))
rarfile.RarCannotExec: Cannot find working tool
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据摘要 pypi docs ,您需要
unrar
路径以使模块工作。它不会实现RAR解开算法本身。(大概您还需要
RAR
来创建档案。)According to the brief PyPI docs, you need
unrar
installed and on your PATH in order for the module to work. It does not implement the RAR unpacking algorithm itself.(Presumably you need
rar
as well, for creating archives.)