bundles / numpy latest / numpy / lib / format / open_memmap
function
numpy.lib.format:open_memmap
source: build-install/usr/lib/python3.14/site-packages/numpy/lib/_format_impl.py :890
Signature
def open_memmap ( filename , mode = r+ , dtype = None , shape = None , fortran_order = False , version = None , * , max_header_size = 10000 ) Summary
Open a .npy file as a memory-mapped array.
Extended Summary
This may be used to read an existing file or create a new one.
Parameters
filename: str or path-likeThe name of the file on disk. This may not be a file-like object.
mode: str, optionalThe mode in which to open the file; the default is 'r+'. In addition to the standard file modes, 'c' is also accepted to mean "copy on write." See memmap for the available mode strings.
dtype: data-type, optionalThe data type of the array if we are creating a new file in "write" mode, if not,
dtypeis ignored. The default value is None, which results in a data-type of float64.shape: tuple of intThe shape of the array if we are creating a new file in "write" mode, in which case this parameter is required. Otherwise, this parameter is ignored and is thus optional.
fortran_order: bool, optionalWhether the array should be Fortran-contiguous (True) or C-contiguous (False, the default) if we are creating a new file in "write" mode.
version: tuple of int (major, minor) or NoneIf the mode is a "write" mode, then this is the version of the file format used to create the file. None means use the oldest supported version that is able to store the data. Default: None
max_header_size: int, optionalMaximum 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.
Returns
marray: memmapThe memory-mapped array.
Raises
: ValueErrorIf the data or the mode is invalid.
: OSErrorIf the file is not found or cannot be opened correctly.
See also
Aliases
-
numpy.lib._format_impl.open_memmap