Numpy 学习之矩阵、函数、二元运算及数组读写

| :-: | :-: |

| a + b | add(a, b) |

| a - b | subtract(a, b) |

| a * b | multiply(a, b) |

| a / b | divide(a, b) |

| a ** b | power(a, b) |

| a % b | remainder(a,b) |

比较与逻辑运算

| 运算符 | 对应函数 |

| :-: | :-: |

| == | equal |

| != | not_equal |

| > | greater |

| >= | greater_equal |

| < | less |

| <= | less_equal |

| & | bitwise_and |

| / | bitwise_or |

| ^ | bitwise_xor |

| ~ | invert |

| >> | right_shift |

| << | left_shift |

ufunc对象


–coding:utf-8–

import numpy as np

“”"

ufunc对象

“”"

reduce方法

op.reduce(a),将op沿着某个轴应用,使得数组啊的维数降低一维

a = np.array([3, 4, 5, 6, 9])

print(np.add.reduce(a))

print(np.logical_or.reduce(a))

accumulate方法

op.accumulate(a),看成保存reduce每一步的结果所形成的数组

print(np.add.accumulate(a))

print(np.logical_or.accumulate(a))

reduceat方法

op.reduceat(a, indices),将操作符运用到指定的下标上

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值