I have a small question which about the funcion of numpy load.
First I save a Matrix called matrix.npy to a Folder called No_Shadowing using np.save. I have the following folder structure: scripts -> Plots -> NO_Shadowing Inside the folder scripts I create a script in which I want to load the saved matrix. I don't understand which path I should give np.load, so that it loads my file. Do I need to give the path from scripts, e.g. something like np.load('Plots/No_Shadowing/matrix.np)? I tested all variants I can imagine, none worked.
CodePudding user response:
Depends...if the path is relative to your current folder you can use:
import os
np.load(os.getcwd() "\\scripts\\Plots\\No_Shadowing\\matrix.np")
or...if scripts is at the root dir.
np.load('c:\\scripts\\Plots\\No_Shadowing\\matrix.np')