<jupyter_start><jupyter_text>Numpy 的 nan 和 inf np.nan<jupyter_code>import numpy as np
type(np.nan)
np.nan is None
np.isnan(np.nan)
np.nan == np.nan
np.nan +1
np.nan *1<jupyter_output><empty_output><jupyter_text>nan总结- 判断`np.nan`不可用 `==np.nan`, 必须使用 `np.isnan()`- `np.nan`不是`None`- `np.nan`参与计算都是`np.nan`不会变  np.inf<jupyter_code>type(np.inf)
np.inf == np.inf
np.inf +1
np.inf *1
np.isinf(np.inf)
np.inf == None<jupyter_output><empty_output><jupyter_text>inf总结- 判断是否为`np.inf`既可以使用`== np.inf` 也可以使用`np.isinf()`- `np.inf`参与计算都是`np.inf`不会变  相关函数- isinf- isnan- isneginf- isposinf- isfinite- nan_to_num<jupyter_code>a = np.array([
    np.inf,np.nan,3
])
np.nan_to_num(a)
np.isinf(a)
np.isnan(a)
np.isneginf(a)
np.isfinite(a)
np.isposinf(a)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19003931847968544, 'fraction_numerical': 0.00655307994757536, 'mean_word_length': 5.643478260869565, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '391595', 'license': 'Apache-2.0', 'n_tokens_mistral': 419, 'n_tokens_neox': 420, 'n_words': 55, 'path': 'doc/numpy/nan_inf.ipynb', 'repo_name': 'huifer/python_doc', 'size': '763'}