提交 23192bb3 编写于 作者: W wizardforcel

9.8

上级 34f2528b
......@@ -97,11 +97,11 @@ x == 3 # 等于
此处显示了比较运算符及其等价`ufunc`的摘要:
| 运算符 | 等价 ufunc || 运算符 | 等价 ufunc |
|---------------|---------------------||---------------|---------------------|
|``==`` |``np.equal`` ||``!=`` |``np.not_equal`` |
|``<`` |``np.less`` ||``<=`` |``np.less_equal`` |
|``>`` |``np.greater`` ||``>=`` |``np.greater_equal`` |
| 运算符 | 等价 ufunc | 运算符 | 等价 ufunc |
| --- | --- | --- | --- |
| ``==`` | ``np.equal`` | ``!=`` | ``np.not_equal`` |
| ``<`` | ``np.less`` | ``<=`` | ``np.less_equal`` |
| ``>`` | ``np.greater`` | ``>=`` | ``np.greater_equal`` |
就像算术`ufunc`的情况一样,这些适用于任何大小和形状的数组。这是一个二维的例子:
......@@ -236,10 +236,10 @@ np.sum(~( (inches <= 0.5) | (inches >= 1) ))
在数组上组合比较运算符和布尔运算符。可以实现广泛的高效逻辑运算。下表总结了按位布尔运算符及其等效的`ufunc`:
| 运算符 | 等价 ufunc || 运算符 | 等价 ufunc |
|---------------|---------------------||---------------|---------------------|
|``&`` |``np.bitwise_and`` || <code>&#124;</code> |``np.bitwise_or`` |
|``^`` |``np.bitwise_xor`` ||``~`` |``np.bitwise_not`` |
| 运算符 | 等价 ufunc | 运算符 | 等价 ufunc |
| --- | --- | --- | --- |
| ``&`` | ``np.bitwise_and`` | <code>&#124;</code> | ``np.bitwise_or`` |
| ``^`` | ``np.bitwise_xor`` | ``~`` | ``np.bitwise_not`` |
使用这些工具,我们可以开始回答有关天气数据的问题。以下是将掩码聚合结合使用时,可以计算的一些结果示例:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册