Files I/O
We'll cover the following
NumPy binary files #
save()
and load()
are used for numpy
binary files with extension .npy
.
The save()
function stores the input array in a disk file with .npy
as the extension. It takes two inputs: the name of the file and the array to be saved.
np.save('filename.npy', arr)
To reconstruct an array from a .npy
file, we use the load()
function. It takes one input argument: the name of the file.
y = np.load('filename.npy')
Get hands-on with 1200+ tech skills courses.