numpy错题整理05——文件保存,格式转化
文章目录
自我介绍
-
我是深圳大学大三的一名大学生,未来想要从事数据分析的工作
-
开始学习python相关库
-
第一步是学习numpy!!
-
若有错误,欢迎指出
资料来源
- 资料来源:https://github.com/fengdu78/Data-Science-Notes
numpy版本
- ‘1.20.3’
刷题
Q1 保存单个array保存到npy文件
-
Save x into
temp.npy
and load it. -
x = np.arange(10) np.save('temp.npy',x) import os if os.path.exists('temp.npy'): x2 = np.load('temp.npy') print(np.array_equal(x,x2))
Q2 保存多个array到npz文件
-
Save x and y into a single file ‘temp.npz’ and load it.
-
x = np.arange(10) y = np.arrange(10,