当前位置:网站首页>numpy. frombuffer()
numpy. frombuffer()
2022-06-26 05:56:00 【Wanderer001】
Reference resources numpy.frombuffer() - cloud + Community - Tencent cloud
numpy.frombuffer
numpy.frombuffer(buffer, dtype=float, count=-1, offset=0)
Interpret a buffer as a 1-dimensional array.
| Parameters: | buffer : buffer_like An object that exposes the buffer interface. dtype : data-type, optional Data-type of the returned array; default: float. count : int, optional Number of items to read. offset : int, optional Start reading the buffer from this offset (in bytes); default: 0. |
|---|
Notes
If the buffer has data that is not in machine byte-order, this should be specified as part of the data-type, e.g.:
>>> dt = np.dtype(int)
>>> dt = dt.newbyteorder(‘>‘)
>>> np.frombuffer(buf, dtype=dt)The data of the resulting array will not be byteswapped, but will be interpreted correctly.
Examples
>>> s = ‘hello world‘
>>> np.frombuffer(s, dtype=‘S1‘, count=5, offset=6)
array([‘w‘, ‘o‘, ‘r‘, ‘l‘, ‘d‘],
dtype=‘|S1‘)>>> np.frombuffer(b‘\x01\x02‘, dtype=np.uint8)
array([1, 2], dtype=uint8)
>>> np.frombuffer(b‘\x01\x02\x03\x04\x05‘, dtype=np.uint8, count=3)
array([1, 2, 3], dtype=uint8)NumPy Of ndarray Array objects cannot be like list Dynamically change its size as well , It is very inconvenient to collect data . How does this article describe np.frombuffer() Implementation of dynamic array .
边栏推荐
猜你喜欢

解决在win10下cmder无法使用find命令

DOM文档

家庭记账程序(第一版)

423-二叉树(110. 平衡二叉树、257. 二叉树的所有路径、100. 相同的树、404. 左叶子之和)

E-commerce seeks growth breakthrough with the help of small program technology

Detailed explanation of serial port communication principle 232, 422, 485

Factory method pattern, abstract factory pattern

MySQL数据库-01数据库概述

Consul service registration and discovery

工厂方法模式、抽象工厂模式
随机推荐
DOM document
A new journey
Force buckle 875 Coco, who likes bananas
cross entropy loss = log softmax + nll loss
REUSE_ ALV_ GRID_ Display event implementation (data_changed)
怎么把平板作为电脑的第二扩展屏幕
类和对象的学习
423-二叉树(110. 平衡二叉树、257. 二叉树的所有路径、100. 相同的树、404. 左叶子之和)
uniCloud云开发获取小程序用户openid
RIA想法
Source code of findcontrol
5分钟包你学会正则表达式
状态模式,身随心变
MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications
花生壳内网穿透映射NPM私服问题
"= =" difference from "equals"
项目中止
睛天霹雳的消息
Project suspension
numpy.random.choice