- 博客(2)
- 收藏
- 关注
原创 numpy的通用函数modf
numpy的通用函数modf modf是python内建函数divmod的向量化版本,返回一个浮点数组的小数部分和整数部分: . import numpy as np . . arr = np.random.randn(7)*5 . out: array([ 7.85894698, 12.13806556, -4.2812833 , 8.89716431, -1.69647657, -5.64989857, 1.39686737]) . remainder,whole_part = np.modf(arr)
2020-08-09 10:39:11
982
原创 Numpy:唯一值与其他集合逻辑
Numpy:唯一值与其他集合逻辑 一、unique方法(Jupyter): eg1: . import numpy as np . . names = np.array([‘Bob’,‘Joe’,‘Will’,‘Bob’,‘Will’,‘Joe’,‘Joe’]) . . np.unique(names) . out1: array([‘Bob’, ‘Joe’, ‘Will’], dtype=’<U4’) eg2: . ints = np.array([3,3,3,2,2,1,1,4,4]) . . n
2020-08-09 10:38:10
425
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅