abs | 取绝对值 |
round | 四舍五入 |
sqrt | 开方 |
math.floor | 向下取整 |
math.ceil | 向上取整 |
int | 向0取整 |
np.floor(a) | a是一维数组,将数组内的数据整体向下取整 |
np.ceil(a) | 将数组内的数据整体向上取整 |
np.round(a) | 将数组内的数据整体四舍五入 |
np.trunc(a) | 将数组内的数据整体向0取整 |
np.rint(a) | np.round的作用一样 |
np.modf(a) | 将a数组中的数据的整数和小数分开,分别组成一个数组 |
np.random.random() | 生成一个(0,1)范围内的随机浮点数 |
np.random.randint(a,b) | 生成一个(a,b)范围内的随机整数 |
np.random.randint(a,b,shape) | c为随机生成数据的形状 |
nan | (not a number) float(nan)不会报错——不存在的数(0/,负数开放) |
inf | 比任何浮点数都大 |
~—反义 | ![]() |
np.maximum | 对比两数组中每项的最大值 |
a.sum() | 求和 |
a.max() | 求最大值 |
a.min() | 求最小值 |
a.mean() | 求平均值 |
a.std() | 求标准差 |
a.argmax() | 求最大值的索引 |
a.argmin() | 求最小值的索引 |