对python读取zip压缩文件里面的csv数据实例详解
作者:qq_24499417 时间:2022-04-14 10:48:57
利用zipfile模块和pandas获取数据,代码比较简单,做个记录吧:
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 21 22:35:59 2018
@author: FanXiaoLei
"""
from zipfile import ZipFile
import pandas as pd
myzip=ZipFile('2.zip')
f=myzip.open('2.csv')
df=pd.read_csv(f)
print(df)
f.close()
myzip.close()
数据打印结果如下图
来源:https://blog.csdn.net/qq_24499417/article/details/82155926
标签:python,zip,csv
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
使用jupyter notebook运行python和R的步骤
2023-03-30 18:22:50
![](https://img.aspxhome.com/file/2023/0/80410_0s.png)
如何将函数的实际参数转换成数组
2010-01-11 19:59:00
PHP的mysqli_set_charset()函数讲解
2023-07-11 06:22:17
![](https://img.aspxhome.com/file/2023/7/55457_0s.png)
python实现npy格式文件转换为txt文件操作
2021-04-03 08:07:05
![](https://img.aspxhome.com/file/2023/5/92075_0s.jpg)
aws 通过boto3 python脚本打pach的实现方法
2021-09-14 23:33:19
ORACLE 如何查询被锁定表及如何解锁释放session
2023-07-02 11:59:39
python自动翻译实现方法
2022-01-01 08:03:31
Python通过pytesseract库实现识别图片中的文字
2021-12-02 14:43:03
![](https://img.aspxhome.com/file/2023/0/86130_0s.png)
AJAX应用之草稿自动保存
2007-08-23 08:29:00
Python实战之自动发送邮件的实现
2023-10-18 15:09:43
![](https://img.aspxhome.com/file/2023/0/90360_0s.png)
python实现定时同步本机与北京时间的方法
2021-03-24 10:58:14
您需要了解的DIV+CSS网页布局的8条面试题目
2010-01-29 13:22:00
6行Python代码实现进度条效果(Progress、tqdm、alive-progress和PySimpleGUI库)
2022-09-15 16:00:46
![](https://img.aspxhome.com/file/2023/9/103489_0s.png)
有效地使用 SQL事件探查器的提示和技巧
2009-01-15 13:39:00
DW实现鼠标滑过切换图片
2008-02-03 18:49:00
![](https://img.aspxhome.com/file/UploadPic/20082/3/200823185431657s.jpg)
python 详解如何使用GPU大幅提高效率
2023-08-24 19:45:46
![](https://img.aspxhome.com/file/2023/0/62550_0s.png)
python 获取等间隔的数组实例
2023-05-21 15:07:16
ASP.NET教程第二讲 ASP.NET学习
2007-08-07 12:01:00
找不到类型或命名空间名称“Server”(是否缺少 using 指令或程序集引用?)
2023-07-07 21:50:15
dpn网络的pytorch实现方式
2023-11-20 10:37:19