{"id":1011616,"date":"2024-12-27T11:31:29","date_gmt":"2024-12-27T03:31:29","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1011616.html"},"modified":"2024-12-27T11:31:31","modified_gmt":"2024-12-27T03:31:31","slug":"python%e7%9a%84nan%e5%a6%82%e4%bd%95%e5%88%a4%e6%96%ad","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1011616.html","title":{"rendered":"python\u7684nan\u5982\u4f55\u5224\u65ad"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25085657\/15983a09-291f-4796-b98a-c8054b2cf9aa.webp\" alt=\"python\u7684nan\u5982\u4f55\u5224\u65ad\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\u5224\u65adNaN\uff08Not a Number\uff09\uff0c\u53ef\u4ee5\u4f7f\u7528math.isnan()\u3001numpy.isnan()\u4ee5\u53capandas.isna()\u7b49\u65b9\u6cd5\u3002\u901a\u5e38\uff0cnumpy.isnan()\u662f\u5904\u7406\u6570\u7ec4\u65f6\u6700\u5e38\u7528\u7684\u65b9\u6cd5\uff0c\u56e0\u4e3anumpy\u5e93\u63d0\u4f9b\u4e86\u5bf9\u6570\u503c\u8fd0\u7b97\u7684\u9ad8\u6548\u652f\u6301\u3002math.isnan()\u5219\u66f4\u9002\u5408\u7528\u4e8e\u5355\u4e00\u6570\u503c\u7684\u5224\u65ad\uff0c\u800cpandas.isna()\u5219\u5728\u5904\u7406\u6570\u636e\u6846\u65f6\u975e\u5e38\u65b9\u4fbf\u3002<\/strong> numpy.isnan()\u662f\u6700\u5e38\u7528\u7684\u65b9\u6cd5\uff0c\u56e0\u4e3a\u5b83\u80fd\u9ad8\u6548\u5730\u5904\u7406\u6570\u7ec4\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\uff0c\u5e76\u8fd4\u56de\u4e00\u4e2a\u5e03\u5c14\u6570\u7ec4\uff0c\u6307\u793a\u6bcf\u4e2a\u5143\u7d20\u662f\u5426\u4e3aNaN\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001PYTHON\u4e2dNAN\u7684\u5b9a\u4e49<\/p>\n<\/p>\n<p><p>NaN\u662f\u201cNot a Number\u201d\u7684\u7f29\u5199\uff0c\u7528\u4e8e\u8868\u793a\u672a\u5b9a\u4e49\u6216\u65e0\u6cd5\u8868\u793a\u7684\u6570\u503c\u7ed3\u679c\u3002\u5728Python\u4e2d\uff0cNaN\u901a\u5e38\u7528\u4e8e\u5904\u7406\u6d6e\u70b9\u8fd0\u7b97\u4e2d\u51fa\u73b0\u7684\u5f02\u5e38\u60c5\u51b5\uff0c\u6bd4\u5982\u96f6\u9664\u6216\u65e0\u6548\u64cd\u4f5c\u7b49\u3002NaN\u662fIEEE 754\u6d6e\u70b9\u6807\u51c6\u7684\u4e00\u90e8\u5206\uff0c\u610f\u5473\u7740\u5b83\u5728\u5927\u591a\u6570\u7f16\u7a0b\u8bed\u8a00\u4e2d\u662f\u901a\u7528\u7684\u3002<\/p>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0cNaN\u503c\u53ef\u4ee5\u901a\u8fc7\u4e0d\u540c\u7684\u65b9\u5f0f\u751f\u6210\u3002\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\u901a\u8fc7numpy\u5e93\u6216math\u5e93\u4e2d\u7684\u7279\u5b9a\u51fd\u6570\u3002numpy\u5e93\u63d0\u4f9b\u4e86\u66f4\u5e7f\u6cdb\u7684\u529f\u80fd\u6765\u5904\u7406\u6570\u7ec4\u548c\u77e9\u9635\u4e2d\u7684NaN\u503c\uff0c\u800cmath\u5e93\u5219\u63d0\u4f9b\u4e86\u57fa\u672c\u7684\u6570\u503c\u8fd0\u7b97\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u4f7f\u7528MATH.ISNAN()\u5224\u65adNAN<\/p>\n<\/p>\n<p><p>math.isnan()\u662fPython\u6807\u51c6\u5e93\u4e2d\u7684\u4e00\u4e2a\u51fd\u6570\uff0c\u7528\u4e8e\u5224\u65ad\u5355\u4e2a\u6570\u503c\u662f\u5426\u4e3aNaN\u3002\u5b83\u53ea\u9002\u7528\u4e8e\u6d6e\u70b9\u6570\uff0c\u5e76\u4e14\u4e0d\u4f1a\u63a5\u53d7\u975e\u6570\u503c\u7c7b\u578b\u7684\u8f93\u5165\u3002<\/p>\n<\/p>\n<ol>\n<li>\u57fa\u672c\u7528\u6cd5<\/li>\n<\/ol>\n<p><p>math.isnan()\u51fd\u6570\u9700\u8981\u5bfc\u5165math\u6a21\u5757\u624d\u80fd\u4f7f\u7528\u3002\u5b83\u63a5\u6536\u4e00\u4e2a\u6d6e\u70b9\u6570\u4f5c\u4e3a\u53c2\u6570\uff0c\u5e76\u8fd4\u56de\u4e00\u4e2a\u5e03\u5c14\u503c\uff1a\u5982\u679c\u53c2\u6570\u662fNaN\uff0c\u5219\u8fd4\u56deTrue\uff0c\u5426\u5219\u8fd4\u56deFalse\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import math<\/p>\n<p>num = float(&#39;nan&#39;)<\/p>\n<p>print(math.isnan(num))  # \u8f93\u51fa: True<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u7279\u6027<\/li>\n<\/ol>\n<p><p>\u7531\u4e8emath.isnan()\u662fPython\u6807\u51c6\u5e93\u7684\u4e00\u90e8\u5206\uff0c\u56e0\u6b64\u4e0d\u9700\u8981\u5b89\u88c5\u989d\u5916\u7684\u5e93\u5373\u53ef\u4f7f\u7528\u3002\u5b83\u7684\u7f3a\u70b9\u662f\u53ea\u80fd\u5904\u7406\u5355\u4e2a\u6570\u503c\uff0c\u65e0\u6cd5\u76f4\u63a5\u7528\u4e8e\u6570\u7ec4\u6216\u5217\u8868\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u4f7f\u7528NUMPY.ISNAN()\u5224\u65adNAN<\/p>\n<\/p>\n<p><p>numpy.isnan()\u662fnumpy\u5e93\u63d0\u4f9b\u7684\u4e00\u4e2a\u51fd\u6570\uff0c\u7528\u4e8e\u5224\u65ad\u6570\u7ec4\u4e2d\u6bcf\u4e2a\u5143\u7d20\u662f\u5426\u4e3aNaN\u3002\u4e0emath.isnan()\u4e0d\u540c\u7684\u662f\uff0cnumpy.isnan()\u53ef\u4ee5\u76f4\u63a5\u7528\u4e8e\u6570\u7ec4\uff0c\u5e76\u8fd4\u56de\u4e00\u4e2a\u5e03\u5c14\u6570\u7ec4\u3002<\/p>\n<\/p>\n<ol>\n<li>\u57fa\u672c\u7528\u6cd5<\/li>\n<\/ol>\n<p><p>\u5728\u4f7f\u7528numpy.isnan()\u4e4b\u524d\uff0c\u9700\u8981\u5b89\u88c5\u5e76\u5bfc\u5165numpy\u5e93\u3002\u5b83\u53ef\u4ee5\u63a5\u6536\u4e00\u4e2a\u6570\u7ec4\u6216\u5355\u4e2a\u6570\u503c\u4f5c\u4e3a\u53c2\u6570\uff0c\u5e76\u8fd4\u56de\u4e00\u4e2a\u5e03\u5c14\u6570\u7ec4\u6216\u5355\u4e2a\u5e03\u5c14\u503c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<p>arr = np.array([1, 2, np.nan, 4])<\/p>\n<p>print(np.isnan(arr))  # \u8f93\u51fa: [False False  True False]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u4f18\u52bf<\/li>\n<\/ol>\n<p><p>numpy.isnan()\u7684\u4e3b\u8981\u4f18\u52bf\u5728\u4e8e\u5176\u5bf9\u6570\u7ec4\u8fd0\u7b97\u7684\u652f\u6301\uff0c\u4f7f\u5176\u5728\u6570\u636e\u5206\u6790\u548c\u79d1\u5b66\u8ba1\u7b97\u4e2d\u975e\u5e38\u5e38\u7528\u3002\u5b83\u80fd\u591f\u9ad8\u6548\u5730\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u96c6\uff0c\u5e76\u4e14\u4e0enumpy\u7684\u5176\u4ed6\u529f\u80fd\u65e0\u7f1d\u96c6\u6210\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u4f7f\u7528PANDAS.ISNA()\u5224\u65adNAN<\/p>\n<\/p>\n<p><p>pandas.isna()\u662fpandas\u5e93\u63d0\u4f9b\u7684\u51fd\u6570\uff0c\u7528\u4e8e\u5224\u65adpandas\u5bf9\u8c61\u4e2d\u7684NaN\u503c\u3002\u5b83\u53ef\u4ee5\u7528\u4e8eSeries\u548cDataFrame\u5bf9\u8c61\u3002<\/p>\n<\/p>\n<ol>\n<li>\u57fa\u672c\u7528\u6cd5<\/li>\n<\/ol>\n<p><p>\u5728\u4f7f\u7528pandas.isna()\u4e4b\u524d\uff0c\u9700\u8981\u5b89\u88c5\u5e76\u5bfc\u5165pandas\u5e93\u3002\u5b83\u53ef\u4ee5\u7528\u4e8eSeries\u6216DataFrame\uff0c\u8fd4\u56de\u4e00\u4e2a\u5e03\u5c14Series\u6216DataFrame\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p>data = {&#39;A&#39;: [1, 2, None], &#39;B&#39;: [4, None, 6]}<\/p>\n<p>df = pd.DataFrame(data)<\/p>\n<p>print(pd.isna(df))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u7279\u6027<\/li>\n<\/ol>\n<p><p>pandas.isna()\u4e0d\u4ec5\u53ef\u4ee5\u68c0\u6d4bNaN\uff0c\u8fd8\u53ef\u4ee5\u68c0\u6d4bpandas\u4e2d\u5176\u4ed6\u8868\u793a\u7f3a\u5931\u6570\u636e\u7684\u7c7b\u578b\uff0c\u5982None\u3002\u5b83\u7684\u8f93\u51fa\u683c\u5f0f\u4e0e\u8f93\u5165\u5bf9\u8c61\u4e00\u81f4\uff0c\u4f7f\u5f97\u5904\u7406\u7f3a\u5931\u6570\u636e\u66f4\u52a0\u76f4\u89c2\u548c\u65b9\u4fbf\u3002<\/p>\n<\/p>\n<p><p>\u4e94\u3001NAN\u503c\u7684\u5904\u7406\u65b9\u6cd5<\/p>\n<\/p>\n<p><p>\u5728\u6570\u636e\u5206\u6790\u548c\u79d1\u5b66\u8ba1\u7b97\u4e2d\uff0c\u5904\u7406NaN\u503c\u662f\u4e00\u4e2a\u5e38\u89c1\u7684\u4efb\u52a1\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5220\u9664NaN\u503c<\/li>\n<\/ol>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u6700\u7b80\u5355\u7684\u89e3\u51b3\u65b9\u6848\u662f\u5220\u9664\u5305\u542bNaN\u503c\u7684\u884c\u6216\u5217\u3002pandas\u63d0\u4f9b\u4e86dropna()\u65b9\u6cd5\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5220\u9664\u7f3a\u5931\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">df_cleaned = df.dropna()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u586b\u5145NaN\u503c<\/li>\n<\/ol>\n<p><p>\u586b\u5145NaN\u503c\u662f\u53e6\u4e00\u79cd\u5904\u7406\u7f3a\u5931\u6570\u636e\u7684\u65b9\u6cd5\u3002\u53ef\u4ee5\u4f7f\u7528fillna()\u65b9\u6cd5\u5c06NaN\u503c\u66ff\u6362\u4e3a\u7279\u5b9a\u503c\uff0c\u5982\u5747\u503c\u3001\u4e2d\u4f4d\u6570\u6216\u5176\u4ed6\u7edf\u8ba1\u91cf\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">df_filled = df.fillna(df.mean())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li>\u63d2\u503c<\/li>\n<\/ol>\n<p><p>\u63d2\u503c\u662f\u4e00\u79cd\u901a\u8fc7\u4f7f\u7528\u5df2\u77e5\u6570\u636e\u70b9\u6765\u4f30\u8ba1\u672a\u77e5\u6570\u636e\u70b9\u7684\u6280\u672f\u3002pandas\u63d0\u4f9b\u4e86interpolate()\u65b9\u6cd5\uff0c\u53ef\u4ee5\u7528\u4e8e\u63d2\u503cNaN\u503c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">df_interpolated = df.interpolate()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u516d\u3001NAN\u5224\u65ad\u7684\u6ce8\u610f\u4e8b\u9879<\/p>\n<\/p>\n<ol>\n<li>NaN\u4e0e\u5176\u4ed6\u6570\u503c\u4e0d\u540c\uff0cNaN\u4e0e\u4efb\u4f55\u503c\uff08\u5305\u62ec\u81ea\u8eab\uff09\u6bd4\u8f83\u65f6\uff0c\u603b\u662f\u8fd4\u56deFalse\u3002\u56e0\u6b64\uff0c\u4e0d\u80fd\u4f7f\u7528==\u6216!=\u64cd\u4f5c\u7b26\u6765\u5224\u65adNaN\u3002<\/li>\n<\/ol>\n<p><pre><code class=\"language-python\">nan_value = float(&#39;nan&#39;)<\/p>\n<p>print(nan_value == nan_value)  # \u8f93\u51fa: False<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u5728\u5904\u7406NaN\u503c\u65f6\uff0c\u5e94\u8003\u8651\u6570\u636e\u7684\u4e0a\u4e0b\u6587\u548c\u7279\u6027\uff0c\u4ee5\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u3002\u4e0d\u540c\u7684\u65b9\u6cd5\u53ef\u80fd\u4f1a\u5bf9\u5206\u6790\u7ed3\u679c\u4ea7\u751f\u4e0d\u540c\u7684\u5f71\u54cd\u3002<\/li>\n<\/ol>\n<p><p>\u4e03\u3001NAN\u5728\u6570\u636e\u5206\u6790\u4e2d\u7684\u5f71\u54cd<\/p>\n<\/p>\n<p><p>NaN\u503c\u5728\u6570\u636e\u5206\u6790\u4e2d\u53ef\u80fd\u4f1a\u5bfc\u81f4\u591a\u79cd\u95ee\u9898\uff0c\u5982\u7edf\u8ba1\u7ed3\u679c\u4e0d\u51c6\u786e\u3001\u6a21\u578b\u8bad\u7ec3\u5931\u8d25\u7b49\u3002\u56e0\u6b64\uff0c\u6b63\u786e\u5904\u7406NaN\u503c\u662f\u6570\u636e\u5206\u6790\u4e2d\u7684\u91cd\u8981\u6b65\u9aa4\u3002\u901a\u8fc7\u5408\u7406\u7684NaN\u5904\u7406\u65b9\u6cd5\uff0c\u53ef\u4ee5\u63d0\u9ad8\u6570\u636e\u8d28\u91cf\uff0c\u5e76\u83b7\u5f97\u66f4\u53ef\u9760\u7684\u5206\u6790\u7ed3\u679c\u3002<\/p>\n<\/p>\n<p><p>\u516b\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u5224\u65adNaN\u503c\u662f\u6570\u636e\u5206\u6790\u548c\u79d1\u5b66\u8ba1\u7b97\u4e2d\u7684\u4e00\u4e2a\u57fa\u672c\u4efb\u52a1\u3002\u901a\u8fc7\u4f7f\u7528math.isnan()\u3001numpy.isnan()\u548cpandas.isna()\u7b49\u51fd\u6570\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u8bc6\u522b\u6570\u636e\u4e2d\u7684NaN\u503c\u3002\u9009\u62e9\u5408\u9002\u7684NaN\u5904\u7406\u65b9\u6cd5\uff0c\u53ef\u4ee5\u6539\u5584\u6570\u636e\u8d28\u91cf\uff0c\u63d0\u5347\u5206\u6790\u7684\u51c6\u786e\u6027\u548c\u53ef\u9760\u6027\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u5e94\u6839\u636e\u5177\u4f53\u7684\u6570\u636e\u7279\u6027\u548c\u5206\u6790\u76ee\u6807\uff0c\u7075\u6d3b\u5e94\u7528\u8fd9\u4e9b\u6280\u672f\u548c\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u68c0\u67e5\u4e00\u4e2a\u503c\u662f\u5426\u4e3aNaN\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528NumPy\u5e93\u7684<code>isnan()<\/code>\u51fd\u6570\u6765\u5224\u65ad\u4e00\u4e2a\u503c\u662f\u5426\u4e3aNaN\u3002\u9996\u5148\uff0c\u786e\u4fdd\u5b89\u88c5\u4e86NumPy\u5e93\u3002\u4f7f\u7528\u793a\u4f8b\uff1a  <\/p>\n<pre><code class=\"language-python\">import numpy as np\nvalue = float(&#39;nan&#39;)\nis_nan = np.isnan(value)\nprint(is_nan)  # \u8f93\u51fa: True\n<\/code><\/pre>\n<p>\u6b64\u5916\uff0cPandas\u5e93\u4e5f\u63d0\u4f9b\u4e86\u7c7b\u4f3c\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pd.isna()<\/code>\u6216<code>pd.isnull()<\/code>\u6765\u68c0\u67e5Series\u6216DataFrame\u4e2d\u7684NaN\u503c\u3002<\/p>\n<p><strong>\u5728\u6570\u636e\u5904\u7406\u65f6\uff0c\u5982\u4f55\u6709\u6548\u5904\u7406NaN\u503c\uff1f<\/strong><br \/>\u5728\u6570\u636e\u5904\u7406\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u4ee5\u9009\u62e9\u51e0\u79cd\u65b9\u6cd5\u6765\u5904\u7406NaN\u503c\u3002\u5e38\u89c1\u7684\u65b9\u6cd5\u5305\u62ec\uff1a  <\/p>\n<ol>\n<li><strong>\u5220\u9664\u5305\u542bNaN\u7684\u884c\u6216\u5217<\/strong>\uff1a\u4f7f\u7528Pandas\u7684<code>dropna()<\/code>\u51fd\u6570\u53ef\u4ee5\u65b9\u4fbf\u5730\u5220\u9664\u5305\u542bNaN\u503c\u7684\u884c\u6216\u5217\u3002  <\/li>\n<li><strong>\u586b\u5145NaN\u503c<\/strong>\uff1a\u53ef\u4ee5\u4f7f\u7528<code>fillna()<\/code>\u51fd\u6570\u6765\u7528\u7279\u5b9a\u503c\uff08\u4f8b\u5982\u5747\u503c\u3001\u4e2d\u4f4d\u6570\u7b49\uff09\u586b\u5145NaN\uff0c\u8fd9\u6837\u53ef\u4ee5\u4fdd\u7559\u6570\u636e\u7684\u5b8c\u6574\u6027\u3002  <\/li>\n<li><strong>\u63d2\u503c\u6cd5<\/strong>\uff1a\u5bf9\u4e8e\u65f6\u95f4\u5e8f\u5217\u6570\u636e\uff0c\u53ef\u4ee5\u4f7f\u7528\u63d2\u503c\u6cd5\u586b\u5145NaN\u503c\uff0c\u8fd9\u6837\u53ef\u4ee5\u4fdd\u6301\u6570\u636e\u7684\u8d8b\u52bf\u548c\u53d8\u5316\u3002<\/li>\n<\/ol>\n<p><strong>\u5728<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u6a21\u578b\u4e2d\uff0c\u5982\u4f55\u5904\u7406NaN\u503c\u5bf9\u7ed3\u679c\u7684\u5f71\u54cd\uff1f<\/strong><br \/>NaN\u503c\u53ef\u80fd\u4f1a\u5bf9\u673a\u5668\u5b66\u4e60\u6a21\u578b\u7684\u8bad\u7ec3\u548c\u9884\u6d4b\u4ea7\u751f\u8d1f\u9762\u5f71\u54cd\u3002\u5904\u7406\u65b9\u6cd5\u5305\u62ec\uff1a  <\/p>\n<ul>\n<li>\u5728\u7279\u5f81\u5de5\u7a0b\u9636\u6bb5\uff0c\u52a1\u5fc5\u68c0\u67e5\u6570\u636e\u96c6\u4e2d\u7684NaN\u503c\uff0c\u5e76\u51b3\u5b9a\u662f\u5220\u9664\u3001\u586b\u5145\u8fd8\u662f\u4fdd\u7559\u8fd9\u4e9b\u503c\u3002  <\/li>\n<li>\u5728\u9009\u62e9\u6a21\u578b\u65f6\uff0c\u67d0\u4e9b\u7b97\u6cd5\uff08\u5982\u51b3\u7b56\u6811\uff09\u5bf9NaN\u503c\u7684\u5bb9\u5fcd\u5ea6\u8f83\u9ad8\uff0c\u800c\u7ebf\u6027\u56de\u5f52\u7b49\u7b97\u6cd5\u5219\u9700\u8981\u5148\u5904\u7406\u597dNaN\u503c\u3002  <\/li>\n<li>\u4f7f\u7528\u4ea4\u53c9\u9a8c\u8bc1\u65f6\uff0c\u786e\u4fdd\u6570\u636e\u96c6\u5728\u4e0d\u540c\u6298\u53e0\u4e2d\u7684\u4e00\u81f4\u6027\uff0c\u4ee5\u9632\u6b62NaN\u503c\u5bf9\u6a21\u578b\u8bc4\u4f30\u7684\u5f71\u54cd\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\u5224\u65adNaN\uff08Not a Number\uff09\uff0c\u53ef\u4ee5\u4f7f\u7528math.isnan()\u3001numpy.isna [&hellip;]","protected":false},"author":3,"featured_media":1011622,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1011616"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1011616"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1011616\/revisions"}],"predecessor-version":[{"id":1011624,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1011616\/revisions\/1011624"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1011622"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1011616"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1011616"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1011616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}