numpy使用记录
来源:互联网 发布:python 迭代器的方法 编辑:程序博客网 时间:2024/06/03 20:29
np.maximum ()
传入两个列表,维度一致,不一致时,进行广播。逐一比较大小,取较大值。
np.max:(a, axis=None, out=None, keepdims=False)
求序列的最值
最少接收一个参数
axis:默认为列向(也即 axis=0),axis = 1 时为行方向的最值;
np.where
np.where(condition,x,y)
condition会得到索引,满足条件,填入数组x在该索引处的值,不满足取y在该索引处的值
new_array=np.where(this_chan == np.min(this_chan),np.nan, this_chan)
在this_chan这个数组,最小值的地方换成nan,返回一个新的数组
np.nanmean
a = np.array([[1, np.nan], [3, 4]])aOut[17]: array([[ 1., nan], [ 3., 4.]])np.nanmean(a) 2.6666666666666665#求所有元素均值,但去除nan,个数也不包括nannp.nanmean(a, axis=0)Out[18]: array([ 2., 4.])#沿着0轴 求均值np.nanmean(a, axis=1) array([ 1., 3.5])#沿着1轴求均值
np.outer
def outer(a, b, out=None): """ Compute the outer product of two vectors. Given two vectors, ``a = [a0, a1, ..., aM]`` and ``b = [b0, b1, ..., bN]``, the outer product [1]_ is:: [[a0*b0 a0*b1 ... a0*bN ] [a1*b0 . [ ... . [aM*b0 aM*bN ]] Parameters ---------- a : (M,) array_like First input vector. Input is flattened if not already 1-dimensional. b : (N,) array_like Second input vector. Input is flattened if not already 1-dimensional. out : (M, N) ndarray, optional A location where the result is stored .. versionadded:: 1.9.0 Returns ------- out : (M, N) ndarray
阅读全文
0 0
- numpy使用记录
- numpy使用过程中小函数记录
- numpy 记录
- numpy 库记录
- numpy 学习记录
- numpy函数记录
- numpy ix_ 学习记录
- numpy使用
- NumPy使用
- numpy 使用
- numpy使用
- python numpy 中函数记录
- python pip numpy安装记录
- 记录numpy的一些用法
- Numpy 和 matplotlib 学习记录
- python numpy使用
- numpy where 的使用
- python numpy使用
- 求助~~js做的打字小游戏
- Java Develop——使用 Jenkins 进行持续集成
- scala和maven整合实践
- 最长公共子串
- JAVA注解
- numpy使用记录
- 用python导入原始数据集
- mysql聚簇索引和非聚簇索引以及二级索引
- 继承
- 300. Longest Increasing Subsequence
- leetcode 82. Remove Duplicates from Sorted List II
- 句子逆序
- 请问在命令提示符上运行exe,怎么传入参数,是多个参数?求大神指导
- Scala结合HttpClient实现简单的爬虫