1

this might seem like stupid question, but i don't know how to resolve this problem.

So i'm trying to integrate a code of mine that i made in ipython and make it look much much better documented. My code uses a numpy file that i made a path to use it for.

So my question is, how would i upload this numpy file to my notebook so I can use it in my .ipynb file? I tried having the .npy and .ipynb files in the same folder, but i'm clueless on how to call it.

Thank you.

1 Answer 1

2

Assuming you created the file with "numpy.save" then you should be able to read it with "numpy.load" if it is in the same directory.

Here's an example:

import numpy as np

x = np.array([[1,2],[3,4],[5,6]])

np.save("test", x)

y = np.load("test.npy")

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

3 Comments

Sorry i'm new and a complete idiot when it comes to these things. I'm not creating a new file. I already have existing file with data i want to use.
If your "filename.npy" file is in the same directory then data = np.load("filename.npy") should load it for you. This does not work for you?
No, but that is most likely because it is not in the same directory. I'll try to fix that and see.

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.