save, filename, mode='w')[source]

Save data to file with given filename.

This function guesses the type of the file from the filename ending. Supported endings:




Pickle without compression


Pickle with gzip compression.

.hdf5, .h5

HDF5 file (using h5py).

  • filename (str) – The name of the file where to save the data.

  • mode (str) – File mode for opening the file. 'w' for write (discard existing file), 'a' for append (add data to existing file). See open() for more details.