I want to save training in a different folder named Check
. How can I save this using np.save
command? I read about np.save
command from documentation but it doesn't describe how to save it in different directory.
sample = np.arange(100).reshape(10,10)
split = 0.7
index = int(floor(len(sample)*split))
training = sample[:index]
np.save("Check"+'train_set.npy',training)
From the (DOCS):
file : file, str, or pathlib.Path
File or filename to which the data is saved. If file is a file-object, then the filename is unchanged. If file is a string or Path, a .npy extension will be appended to the file name if it does not already have one.
This states that if the filename has a directory (ie: Path), it will be stored there. So something like this should do what you need:
import os
np.save(os.path.join('Check', 'train_set'), training)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With