1

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

self.q.dump(fileName)

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?

1

1 Answer 1

3
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 should work fine.

Sign up to request clarification or add additional context in comments.

2 Comments

Yes but it doesn't. AttributeError: 'numpy.ndarray' object has no attribute 'load'
@d.e.: I'ts not a method on an array, it's a function. Be sure to call it like numpy.load(filename), not q.load(..) (where q is an array).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.