Skip to main content
`Ctrl`+`K`

# numpy.lib.format.read_array

lib.format.read_array(fp, allow_pickle=False, pickle_kwargs=None, *, max_header_size=10000)

  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

    pickle_kwargs dict

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

    max_header_size int, optional

      Maximum allowed size of the header. Large headers may not be safe to load securely and thus require explicitly passing a larger value. See `ast.literal_eval` for details. This option is ignored when allow_pickle is passed. In that case the file is by definition trusted and the limit is unnecessary.

  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.