Pandas——⑤读取导出文件

Pandas——读取导出文件

python入门常用操作:https://blog.csdn.net/qq_33302004/article/details/112859327

 

新建数据文件:

内容如下:

import pandas as pd

# 储存或者调用数据表格
# pandas中可以读取的格式:
# read_csv / read_excel / read_hdf / read_sql / read_json / read_msgpack / read_html /
# read_gbq / read_stata / read_sas / read_clipboard / read_pickle

# 推荐csv和pickle
# csv是最基础简单的格式、pickle是python自带的压缩格式

# pandas中的保存方式:
# to_csv / to_excel / to_hdf / to_sql / to_json / to_msgpack / to_html /
# to_gbq / to_stata / to_sas / to_clipboard / to_pickle

# 读取
dates = pd.read_csv('3-pandas/笔记5-students.csv')
print(dates)
# 存储
dates.to_pickle('3-pandas/笔记5-students.pickle')
dates_2 = pd.read_pickle('3-pandas/笔记5-students.pickle')
print(dates_2)

使用to_pickle文件夹下出现保存后的文件:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值