Create an array from binary file data
If file is a string or a path-like object then that file is opened, else it is assumed to be a file object. The file object must support random access (i.e. it must have tell and seek methods).
valid dtype for all arrays
shape of each array.
Position in the file to start reading from.
If dtype
is None
, these arguments are passed to numpy.format_parser to construct a dtype. See that function for detailed documentation
record array consisting of data enclosed in file.
Examples
>>> from tempfile import TemporaryFile >>> a = np.empty(10,dtype='f8,i4,a5') >>> a[5] = (0.5,10,'abcde') >>> >>> fd=TemporaryFile() >>> a = a.view(a.dtype.newbyteorder('<')) >>> a.tofile(fd) >>> >>> _ = fd.seek(0) >>> r=np.rec.fromfile(fd, formats='f8,i4,a5', shape=10, ... byteorder='<') >>> print(r[5]) (0.5, 10, b'abcde') >>> r.shape (10,)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4