save(file, arr, allow_pickle=True, fix_imports=True)
For a description of the .npy
format, see numpy.lib.format
.
Any data saved to the file is appended to the end of the file.
File or filename to which the data is saved. If file is a file-object, then the filename is unchanged. If file is a string or Path, a .npy
extension will be appended to the filename if it does not already have one.
Array data to be saved.
Allow saving object arrays using Python pickles. Reasons for disallowing pickles include security (loading pickled data can execute arbitrary code) and portability (pickled objects may not be loadable on different Python installations, for example if the stored objects require libraries that are not available, and not all pickled data is compatible between Python 2 and Python 3). Default: True
Only useful in forcing objects in object arrays on Python 3 to be pickled in a Python 2 compatible way. If :None:None:`fix_imports`
is True, pickle will try to map the new Python 3 names to the old module names used in Python 2, so that the pickle data stream is readable with Python 2.
Save an array to a binary file in NumPy .npy
format.
savez
Save several arrays into a .npz
archive
>>> from tempfile import TemporaryFile
... outfile = TemporaryFile()
>>> x = np.arange(10)
... np.save(outfile, x)
>>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file
... np.load(outfile) array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> with open('test.npy', 'wb') as f:See :
... np.save(f, np.array([1, 2]))
... np.save(f, np.array([1, 3]))
... with open('test.npy', 'rb') as f:
... a = np.load(f)
... b = np.load(f)
... print(a, b) # [1 2] [1 3]
The following pages refer to to this document either explicitly or contain code examples using this.
numpy.fromfile
numpy.savez_compressed
numpy.savetxt
numpy.load
numpy.savez
numpy.lib.format
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them