加载和保存numpy矩阵 [英] Loading and saving numpy matrix

查看:114
本文介绍了加载和保存numpy矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在加载numpy矩阵时遇到麻烦.我已成功通过以下方式将其保存到磁盘:

I'm having troubles loading a numpy matrix. I successfully saved it to disk through:

self.q.dump(fileName)

,现在我希望能够加载它.据我了解,load命令应该可以解决问题:

and now I want to be able to load it. From what I understand, the load command should do the trick:

self.q.load(fileName)

但似乎不是.有人知道怎么了吗?也许该函数不称为加载?

but it seems not. Anyone knows what might be wrong? Maybe the function is not called load?

推荐答案

help(numpy.ndarray)

 |  dump(...)
 |      a.dump(file)
 |      
 |      Dump a pickle of the array to the specified file.
 |      The array can be read back with pickle.load or numpy.load.
 |      
 |      Parameters
 |      ----------
 |      file : str
 |          A string naming the dump file.

numpy.load应该可以正常工作.

这篇关于加载和保存numpy矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆