MCPcopy Index your code
hub / github.com/numpy/numpy / savez

Function savez

numpy/lib/_npyio_impl.py:581–673  ·  view source on GitHub ↗

Save several arrays into a single file in uncompressed ``.npz`` format. Provide arrays as keyword arguments to store them under the corresponding name in the output file: ``savez(fn, x=x, y=y)``. If arrays are specified as positional arguments, i.e., ``savez(fn, x, y)``, their name

(file, *args, allow_pickle=True, **kwds)

Source from the content-addressed store, hash-verified

579
580@array_function_dispatch(_savez_dispatcher)
581def savez(file, *args, allow_pickle=True, **kwds):
582 """Save several arrays into a single file in uncompressed ``.npz`` format.
583
584 Provide arrays as keyword arguments to store them under the
585 corresponding name in the output file: ``savez(fn, x=x, y=y)``.
586
587 If arrays are specified as positional arguments, i.e., ``savez(fn,
588 x, y)``, their names will be `arr_0`, `arr_1`, etc.
589
590 Parameters
591 ----------
592 file : file, str, or pathlib.Path
593 Either the filename (string) or an open file (file-like object)
594 where the data will be saved. If file is a string or a Path, the
595 ``.npz`` extension will be appended to the filename if it is not
596 already there.
597 args : Arguments, optional
598 Arrays to save to the file. Please use keyword arguments (see
599 `kwds` below) to assign names to arrays. Arrays specified as
600 args will be named "arr_0", "arr_1", and so on.
601 allow_pickle : bool, optional
602 Allow saving object arrays using Python pickles. Reasons for
603 disallowing pickles include security (loading pickled data can execute
604 arbitrary code) and portability (pickled objects may not be loadable
605 on different Python installations, for example if the stored objects
606 require libraries that are not available, and not all pickled data is
607 compatible between different versions of Python).
608 Default: True
609 kwds : Keyword arguments, optional
610 Arrays to save to the file. Each array will be saved to the
611 output file with its corresponding keyword name.
612
613 Returns
614 -------
615 None
616
617 See Also
618 --------
619 save : Save a single array to a binary file in NumPy format.
620 savetxt : Save an array to a file as plain text.
621 savez_compressed : Save several arrays into a compressed ``.npz`` archive
622
623 Notes
624 -----
625 The ``.npz`` file format is a zipped archive of files named after the
626 variables they contain. The archive is not compressed and each file
627 in the archive contains one variable in ``.npy`` format. For a
628 description of the ``.npy`` format, see :py:mod:`numpy.lib.format`.
629
630 When opening the saved ``.npz`` file with `load` a `~lib.npyio.NpzFile`
631 object is returned. This is a dictionary-like object which can be queried
632 for its list of arrays (with the ``.files`` attribute), and for the arrays
633 themselves.
634
635 Keys passed in `kwds` are used as filenames inside the ZIP archive.
636 Therefore, keys should be valid filenames; e.g., avoid keys that begin with
637 ``/`` or contain ``.``.
638

Callers

nothing calls this directly

Calls 1

_savezFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…