当前位置:网站首页>numpy.put()
numpy.put()
2022-07-26 20:11:00 【Wanderer001】
numpy.put
numpy.put(a, ind, v, mode='raise')
Replaces specified elements of an array with given values.The indexing works on the flattened target array. put is roughly equivalent to:
a.flat[ind] = v| Parameters: | a : ndarray Target array. ind : array_like Target indices, interpreted as integers. v : array_like Values to place in a at target indices. If v is shorter than ind it will be repeated as necessary. mode : {‘raise’, ‘wrap’, ‘clip’}, optional Specifies how out-of-bounds indices will behave.
‘clip’ mode means that all indices that are too large are replaced by the index that addresses the last element along that axis. Note that this disables indexing with negative numbers. In ‘raise’ mode, if an exception occurs the target array may still be modified. |
|---|
See also
Put elements by matching the array and the index arrays
Examples
>>> a = np.arange(5)
>>> np.put(a, [0, 2], [-44, -55])
>>> a
array([-44, 1, -55, 3, 4])
>>> a = np.arange(5)
>>> np.put(a, 22, -5, mode='clip')
>>> a
array([ 0, 1, 2, 3, -5])边栏推荐
- Live video source code to achieve the advertising effect of scrolling up and down
- How to wait for the return results of multiple asynchronous tasks synchronously?
- cv2.resize()
- Bug feedback: synchronization failed
- Software testing - what are the automated testing frameworks?
- Use request header authentication to test API interfaces that need authorization
- 金仓数据库 KingbaseES SQL 语言参考手册 (18. SQL语句: DROP MATERIALIZED VIEW 到 DROP SYNONYM)
- 客户案例|生学教育依托观测云打造可观测智慧教育新生态
- 开源 | AREX-携程无代码侵入的流量回放实践
- How to uninstall win11 edge? The method tutorial of completely uninstalling win11 edge browser
猜你喜欢

3万脱发人,撑起一个IPO

一个开源的网页画板,真的太方便了

Ten sorting details

C # use the default transformation method

Latte dht-phev products are very popular. Will the sales volume make Li Ruifeng figure it out?

C# 使用默认转型方法

一文读懂 .NET 中的高性能队列 Channel

计算机组成原理常见面试题目总结,含答案

客户案例|生学教育依托观测云打造可观测智慧教育新生态

Week 6 Convolutional Neural Networks (CNNs)
随机推荐
tf.GraphKeys
BluePrism流程业务对象的组件功能介绍-RPA第三章
EFCore Migrations的深入研究
eadiness probe failed: calico/node is not ready: BIRD is not ready: Error querying BIRD: unable to c
Use of load balancing
Dio问题总结
SQL注入
Zabbix调用api检索方法
Collection of original IOS interview questions
Kingbasees SQL language reference manual of Jincang database (19. SQL statement: drop table to load)
UE5编辑器Slate快速入门【开篇】
numpy.newaxis
Week 6 Convolutional Neural Networks (CNNs)
【Android】Kotlin 快速编译背后的黑科技,了解一下~
【Pytorch基础】torch.stack()函数解析
金仓数据库 KingbaseES SQL 语言参考手册 (19. SQL语句: DROP TABLE 到 LOAD)
几张图帮你捋清“中国金融机构体系”
操作系统常见面试题目总结,含答案
I tried many report tools and finally found a report based on Net 6
Solution to the third game of 2022 Niuke multi school league