numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersRaises
write_array(fp, array, version=None, allow_pickle=True, pickle_kwargs=None)

If the array is neither C-contiguous nor Fortran-contiguous AND the file_like object is not a real file object, this function will have to copy data in memory.

Parameters

fp : file_like object

An open, writable file object, or similar object with a .write() method.

array : ndarray

The array to write to disk.

version : (int, int) or None, optional

The version number of the format. None means use the oldest supported version that is able to store the data. Default: None

allow_pickle : bool, optional

Whether to allow writing pickled data. Default: True

pickle_kwargs : dict, optional

Additional keyword arguments to pass to pickle.dump, excluding 'protocol'. These are only useful when pickling objects in object arrays on Python 3 to Python 2 compatible format.

Raises

ValueError

If the array cannot be persisted. This includes the case of allow_pickle=False and array being an object array.

Various other errors

If the array contains Python objects as part of its dtype, the process of pickling them may raise various errors if the objects are not picklable.

Write an array to an NPY file, including a header.

Examples

See :

Local connectivity graph

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


GitHub : /numpy/lib/format.py#626
type: <class 'function'>
Commit: