@@ -603,18 +603,56 @@ def savez_compressed(file, *args, **kwds):
603603
604604 Parameters
605605 ----------
606- file : str
607- File name of ``.npz`` file.
608- args : Arguments
609- Function arguments.
610- kwds : Keyword arguments
611- Keywords.
606+ file : str or file
607+ Either the file name (string) or an open file (file-like object)
608+ where the data will be saved. If file is a string or a Path, the
609+ ``.npz`` extension will be appended to the file name if it is not
610+ already there.
611+ args : Arguments, optional
612+ Arrays to save to the file. Since it is not possible for Python to
613+ know the names of the arrays outside `savez`, the arrays will be saved
614+ with names "arr_0", "arr_1", and so on. These arguments can be any
615+ expression.
616+ kwds : Keyword arguments, optional
617+ Arrays to save to the file. Arrays will be saved in the file with the
618+ keyword names.
619+
620+ Returns
621+ -------
622+ None
612623
613624 See Also
614625 --------
626+ numpy.save : Save a single array to a binary file in NumPy format.
627+ numpy.savetxt : Save an array to a file as plain text.
615628 numpy.savez : Save several arrays into an uncompressed ``.npz`` file format
616629 numpy.load : Load the files created by savez_compressed.
617630
631+ Notes
632+ -----
633+ The ``.npz`` file format is a zipped archive of files named after the
634+ variables they contain. The archive is compressed with
635+ ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable
636+ in ``.npy`` format. For a description of the ``.npy`` format, see
637+ `numpy.lib.format` or the NumPy Enhancement Proposal
638+ http://docs.scipy.org/doc/numpy/neps/npy-format.html
639+
640+ When opening the saved ``.npz`` file with `load` a `NpzFile` object is
641+ returned. This is a dictionary-like object which can be queried for
642+ its list of arrays (with the ``.files`` attribute), and for the arrays
643+ themselves.
644+
645+ Examples
646+ --------
647+ >>> test_array = np.random.rand(3, 2)
648+ >>> test_vector = np.random.rand(4)
649+ >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector)
650+ >>> loaded = np.load('/tmp/123.npz')
651+ >>> print(np.array_equal(test_array, loaded['a']))
652+ True
653+ >>> print(np.array_equal(test_vector, loaded['b']))
654+ True
655+
618656 """
619657 _savez (file , args , kwds , True )
620658
0 commit comments