Files
open-cv-experiment/test/2024,09,29/test4.py
T
2024-09-30 20:53:34 +08:00

9 lines
256 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 练习题4: 使用布尔索引
# 题目: 有一个NumPy数组 a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
# 请使用布尔索引获取所有大于5的元素。
import numpy as np
a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
print(a[a > 5])