<jupyter_start><jupyter_text>Boolean Operations<jupyter_code>import numpy as np
x = np.array([1, 2, 3, 4,5])
x < 3
x > 3
x <= 3
x >= 3
x != 3
#  how many values less than 6?
np.count_nonzero(x < 6)
np.sum(x < 6)
# how many values less than 6 in each row?
x = np.arange(1,10).reshape((3,3))
print(x)
np.sum( x < 5, axis=1)
# are there any value greater than 7?
np.any(x > 7)
# are there all values equals to 10?
np.all(x == 10)
# are all values in each row less than 10?
np.all(x < 10, axis=1)
# new array 
y = x[x<5]
y<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1551094890510949, 'fraction_numerical': 0.060218978102189784, 'mean_word_length': 3.9017857142857144, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 8, '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': '667448', 'license': 'MIT', 'n_tokens_mistral': 262, 'n_tokens_neox': 237, 'n_words': 81, 'path': '6_numpy_boolean_operations.ipynb', 'repo_name': 'ssozuer/numpy', 'size': '548'}