save(file, arr)

Save an array to a binary file in NumPy .npy format.

  • file (str) – File or filename to which the data is saved. If file is a file-object, then the filename is unchanged.

  • arr (ndarray) – Array data to be saved. Sparse formats are not supported. Please use savez function to save sparse arrays.

See also


Save several arrays into a .npz archive


For a description of the .npy format, see numpy.lib.format.