<jupyter_start><jupyter_text>numpy.array()的比较<jupyter_code>x
x < 3
x == 3
x != 3
2 * x == 24 - 4 * x
X
X < 6
x
np.sum(x <= 3)
np.count_nonzero(x <= 3)
# 两个bool数组，按照位进行与运算
a = (x >= 3) & (x <= 5)
a
np.sum(a)
# boole数组中，是否有任何非零元素，any()，只要有一个true，则返回true
# boole数组中，所有元素都为true，则返回true，
np.any(x == 0)

np.any(x < 0)
np.all(x >= 0)
np.all(x > 0)
X 
np.sum(X % 2 == 0)
np.sum(X %2 == 0, axis=1)
np.sum(X % 2 == 0, axis=0)
np.all(X > 0, axis=1)
np.sum((x % 2 == 0) | (x > 10))
np.sum(~(x==0))
x[x < 5]
x[x % 2 == 0]
X[X[:, -1] % 3 == 0, :]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.25932504440497334, 'fraction_numerical': 0.06571936056838366, 'mean_word_length': 3.5853658536585367, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '425712', 'license': 'MIT', 'n_tokens_mistral': 370, 'n_tokens_neox': 349, 'n_words': 69, 'path': 'ml/basicNumpy/05-fancy-indexing.ipynb', 'repo_name': 'tangchunbo/machine-learning', 'size': '563'}