numpy / 1.22.0 / reference / generated / numpy.lib.format.read_array.html /

numpy.lib.format.read_array

lib.format. read_array ( fp, allow_pickle=False, pickle_kwargs=None ) [source]

Read an array from an NPY file.

Parameters
fp file_like object

If this is not a real file object, then this may take extra memory and time.

allow_pickle bool, optional

Whether to allow writing pickled data. Default: False

Changed in version 1.16.3: Made default False in response to CVE-2019-6446.

pickle_kwargs dict

Additional keyword arguments to pass to pickle.load. These are only useful when loading object arrays saved on Python 2 when using Python 3.

Returns
array ndarray

The array from the data on disk.

Raises
ValueError

If the data is invalid, or allow_pickle=False and the file contains an object array.

© 2005–2021 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/1.22/reference/generated/numpy.lib.format.read_array.html