numpy中一些函数方法整理

np.bincount()

numpy官方文档中解释:Count number of occurrences of each value in array of non-negative ints

统计非负数整数出现的次数。索引是从零开始的,所以bin的长度会比统计向量长度大1。

例子:

另外,bincount函数中有 weights 这个参数, 如果 weights 参数被指定,那么 np.bincount(x,weight)中 就会被加权。

例子:

1.1 = 0.7 + 1 + (-0.6)

np.array_split()

numpy 官方文档中解释:Split an array into multiple sub-arrays

例子:

posted @   CharlesLC  阅读(25)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示