import numpy as np
1、where函数
通过index删除单行、删除单列、删除多行
通过where函数过滤数据
```python
def findByWhere():
"""
使用where过滤数据
:return:
"""
source = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
# 过滤大于4的数据
filter_arr1 = source[np.where(source > 4)]
print("---------")
print(filter_arr1)
# 过滤大于4的数据并重新赋值
filter_arr2 = np.array(np.where(source > 4, 1, 0))
print(filter_arr2)
原始数据
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
filter_arr1 过滤大于4的数据 返回结果
[5 6 7 8 9]
filter_arr2 过滤大于4的数据并重新赋值 返回结果
[0 0 0 0 0 1 1 1 1 1]