{"id":1102177,"date":"2025-01-08T15:57:13","date_gmt":"2025-01-08T07:57:13","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1102177.html"},"modified":"2025-01-08T15:57:19","modified_gmt":"2025-01-08T07:57:19","slug":"python%e5%a6%82%e4%bd%95%e5%af%b9%e8%80%83%e8%af%95%e6%88%90%e7%bb%a9%e5%88%86%e6%9e%90-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1102177.html","title":{"rendered":"python\u5982\u4f55\u5bf9\u8003\u8bd5\u6210\u7ee9\u5206\u6790"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25064616\/35ece213-38eb-45e0-8068-91c8295d60f6.webp\" alt=\"python\u5982\u4f55\u5bf9\u8003\u8bd5\u6210\u7ee9\u5206\u6790\" \/><\/p>\n<p><p> <strong>\u4f7f\u7528Python\u5bf9\u8003\u8bd5\u6210\u7ee9\u8fdb\u884c\u5206\u6790\u7684\u6838\u5fc3\u65b9\u6cd5\u6709\uff1a\u6570\u636e\u9884\u5904\u7406\u3001\u7edf\u8ba1\u5206\u6790\u3001\u53ef\u89c6\u5316\u5206\u6790\u3001\u56de\u5f52\u5206\u6790\u3002<\/strong> \u5176\u4e2d\uff0c\u6570\u636e\u9884\u5904\u7406\u662f\u6700\u57fa\u7840\u4e5f\u662f\u6700\u91cd\u8981\u7684\u4e00\u6b65\uff0c\u56e0\u4e3a\u6570\u636e\u8d28\u91cf\u76f4\u63a5\u5f71\u54cd\u5206\u6790\u7ed3\u679c\u7684\u51c6\u786e\u6027\u3002\u6570\u636e\u9884\u5904\u7406\u5305\u62ec\u6570\u636e\u6e05\u6d17\u3001\u683c\u5f0f\u8f6c\u6362\u3001\u7f3a\u5931\u503c\u5904\u7406\u548c\u6570\u636e\u6807\u51c6\u5316\u7b49\u6b65\u9aa4\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Python\u5bf9\u8003\u8bd5\u6210\u7ee9\u8fdb\u884c\u5206\u6790\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u6570\u636e\u9884\u5904\u7406<\/h3>\n<\/p>\n<p><p>\u6570\u636e\u9884\u5904\u7406\u662f\u5206\u6790\u8003\u8bd5\u6210\u7ee9\u7684\u7b2c\u4e00\u6b65\uff0c\u5b83\u5305\u62ec\u6570\u636e\u6e05\u6d17\u3001\u683c\u5f0f\u8f6c\u6362\u3001\u7f3a\u5931\u503c\u5904\u7406\u548c\u6570\u636e\u6807\u51c6\u5316\u7b49\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u6570\u636e\u6e05\u6d17<\/h4>\n<\/p>\n<p><p>\u6570\u636e\u6e05\u6d17\u662f\u6307\u8bc6\u522b\u548c\u7ea0\u6b63\u6570\u636e\u4e2d\u7684\u9519\u8bef\u6216\u4e0d\u4e00\u81f4\u3002\u4f8b\u5982\uff0c\u68c0\u67e5\u6570\u636e\u662f\u5426\u6709\u91cd\u590d\u8bb0\u5f55\uff0c\u662f\u5426\u5b58\u5728\u5f02\u5e38\u503c\u7b49\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528pandas\u5e93\u6765\u8fdb\u884c\u6570\u636e\u6e05\u6d17\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<h2><strong>\u8bfb\u53d6\u6570\u636e<\/strong><\/h2>\n<p>data = pd.read_csv(&#39;exam_scores.csv&#39;)<\/p>\n<h2><strong>\u68c0\u67e5\u662f\u5426\u6709\u91cd\u590d\u8bb0\u5f55<\/strong><\/h2>\n<p>duplicates = data.duplicated()<\/p>\n<p>print(&quot;\u662f\u5426\u6709\u91cd\u590d\u8bb0\u5f55: &quot;, duplicates.any())<\/p>\n<h2><strong>\u5220\u9664\u91cd\u590d\u8bb0\u5f55<\/strong><\/h2>\n<p>data = data.drop_duplicates()<\/p>\n<h2><strong>\u68c0\u67e5\u662f\u5426\u6709\u7f3a\u5931\u503c<\/strong><\/h2>\n<p>missing_values = data.isnull().sum()<\/p>\n<p>print(&quot;\u7f3a\u5931\u503c: \\n&quot;, missing_values)<\/p>\n<h2><strong>\u5220\u9664\u542b\u6709\u7f3a\u5931\u503c\u7684\u8bb0\u5f55<\/strong><\/h2>\n<p>data = data.dropna()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u683c\u5f0f\u8f6c\u6362<\/h4>\n<\/p>\n<p><p>\u683c\u5f0f\u8f6c\u6362\u662f\u6307\u5c06\u6570\u636e\u8f6c\u6362\u4e3a\u5206\u6790\u6240\u9700\u7684\u683c\u5f0f\u3002\u4f8b\u5982\uff0c\u5c06\u65e5\u671f\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u65e5\u671f\u5bf9\u8c61\uff0c\u5c06\u5206\u7c7b\u53d8\u91cf\u8f6c\u6362\u4e3a\u6570\u503c\u53d8\u91cf\u7b49\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528pandas\u5e93\u6765\u8fdb\u884c\u683c\u5f0f\u8f6c\u6362\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5c06\u65e5\u671f\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u65e5\u671f\u5bf9\u8c61<\/p>\n<p>data[&#39;exam_date&#39;] = pd.to_datetime(data[&#39;exam_date&#39;])<\/p>\n<h2><strong>\u5c06\u5206\u7c7b\u53d8\u91cf\u8f6c\u6362\u4e3a\u6570\u503c\u53d8\u91cf<\/strong><\/h2>\n<p>data[&#39;gender&#39;] = data[&#39;gender&#39;].map({&#39;male&#39;: 1, &#39;female&#39;: 0})<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u7edf\u8ba1\u5206\u6790<\/h3>\n<\/p>\n<p><p>\u7edf\u8ba1\u5206\u6790\u662f\u5bf9\u6570\u636e\u8fdb\u884c\u63cf\u8ff0\u6027\u7edf\u8ba1\u548c\u63a8\u65ad\u6027\u7edf\u8ba1\u3002\u4f8b\u5982\uff0c\u8ba1\u7b97\u5e73\u5747\u503c\u3001\u4e2d\u4f4d\u6570\u3001\u6807\u51c6\u5dee\u7b49\u63cf\u8ff0\u6027\u7edf\u8ba1\u91cf\uff0c\u8fdb\u884c\u5047\u8bbe\u68c0\u9a8c\u3001\u76f8\u5173\u6027\u5206\u6790\u7b49\u63a8\u65ad\u6027\u7edf\u8ba1\u5206\u6790\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528pandas\u548cscipy\u5e93\u6765\u8fdb\u884c\u7edf\u8ba1\u5206\u6790\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u63cf\u8ff0\u6027\u7edf\u8ba1\u5206\u6790<\/h4>\n<\/p>\n<p><p>\u63cf\u8ff0\u6027\u7edf\u8ba1\u5206\u6790\u662f\u5bf9\u6570\u636e\u8fdb\u884c\u57fa\u672c\u7edf\u8ba1\u63cf\u8ff0\uff0c\u4f8b\u5982\u8ba1\u7b97\u5e73\u5747\u503c\u3001\u4e2d\u4f4d\u6570\u3001\u6807\u51c6\u5dee\u7b49\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528pandas\u5e93\u6765\u8fdb\u884c\u63cf\u8ff0\u6027\u7edf\u8ba1\u5206\u6790\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u8ba1\u7b97\u5e73\u5747\u503c<\/p>\n<p>mean_score = data[&#39;score&#39;].mean()<\/p>\n<p>print(&quot;\u5e73\u5747\u6210\u7ee9: &quot;, mean_score)<\/p>\n<h2><strong>\u8ba1\u7b97\u4e2d\u4f4d\u6570<\/strong><\/h2>\n<p>median_score = data[&#39;score&#39;].median()<\/p>\n<p>print(&quot;\u4e2d\u4f4d\u6210\u7ee9: &quot;, median_score)<\/p>\n<h2><strong>\u8ba1\u7b97\u6807\u51c6\u5dee<\/strong><\/h2>\n<p>std_score = data[&#39;score&#39;].std()<\/p>\n<p>print(&quot;\u6210\u7ee9\u6807\u51c6\u5dee: &quot;, std_score)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u63a8\u65ad\u6027\u7edf\u8ba1\u5206\u6790<\/h4>\n<\/p>\n<p><p>\u63a8\u65ad\u6027\u7edf\u8ba1\u5206\u6790\u662f\u5bf9\u6570\u636e\u8fdb\u884c\u5047\u8bbe\u68c0\u9a8c\u3001\u76f8\u5173\u6027\u5206\u6790\u7b49\uff0c\u4ee5\u63a8\u65ad\u603b\u4f53\u7279\u5f81\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528scipy\u5e93\u6765\u8fdb\u884c\u63a8\u65ad\u6027\u7edf\u8ba1\u5206\u6790\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from scipy import stats<\/p>\n<h2><strong>t\u68c0\u9a8c<\/strong><\/h2>\n<p>t_test = stats.ttest_1samp(data[&#39;score&#39;], 50)<\/p>\n<p>print(&quot;t\u68c0\u9a8c\u7ed3\u679c: &quot;, t_test)<\/p>\n<h2><strong>\u76f8\u5173\u6027\u5206\u6790<\/strong><\/h2>\n<p>correlation = data.corr()<\/p>\n<p>print(&quot;\u76f8\u5173\u6027\u5206\u6790: \\n&quot;, correlation)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u53ef\u89c6\u5316\u5206\u6790<\/h3>\n<\/p>\n<p><p>\u53ef\u89c6\u5316\u5206\u6790\u662f\u901a\u8fc7\u56fe\u5f62\u6765\u5c55\u793a\u6570\u636e\u7279\u5f81\uff0c\u4f8b\u5982\u7ed8\u5236\u76f4\u65b9\u56fe\u3001\u7bb1\u7ebf\u56fe\u3001\u6563\u70b9\u56fe\u7b49\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528matplotlib\u548cseaborn\u5e93\u6765\u8fdb\u884c\u53ef\u89c6\u5316\u5206\u6790\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u7ed8\u5236\u76f4\u65b9\u56fe<\/h4>\n<\/p>\n<p><p>\u76f4\u65b9\u56fe\u7528\u4e8e\u5c55\u793a\u6570\u636e\u5206\u5e03\u60c5\u51b5\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528matplotlib\u5e93\u6765\u7ed8\u5236\u76f4\u65b9\u56fe\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u7ed8\u5236\u76f4\u65b9\u56fe<\/strong><\/h2>\n<p>plt.hist(data[&#39;score&#39;], bins=10, edgecolor=&#39;k&#39;)<\/p>\n<p>plt.xlabel(&#39;\u6210\u7ee9&#39;)<\/p>\n<p>plt.ylabel(&#39;\u9891\u6570&#39;)<\/p>\n<p>plt.title(&#39;\u6210\u7ee9\u5206\u5e03\u76f4\u65b9\u56fe&#39;)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u7ed8\u5236\u7bb1\u7ebf\u56fe<\/h4>\n<\/p>\n<p><p>\u7bb1\u7ebf\u56fe\u7528\u4e8e\u5c55\u793a\u6570\u636e\u5206\u5e03\u7684\u4e94\u6570\u6982\u62ec\uff08\u6700\u5c0f\u503c\u3001\u4e0b\u56db\u5206\u4f4d\u6570\u3001\u4e2d\u4f4d\u6570\u3001\u4e0a\u56db\u5206\u4f4d\u6570\u3001\u6700\u5927\u503c\uff09\u548c\u5f02\u5e38\u503c\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528seaborn\u5e93\u6765\u7ed8\u5236\u7bb1\u7ebf\u56fe\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import seaborn as sns<\/p>\n<h2><strong>\u7ed8\u5236\u7bb1\u7ebf\u56fe<\/strong><\/h2>\n<p>sns.boxplot(x=data[&#39;score&#39;])<\/p>\n<p>plt.xlabel(&#39;\u6210\u7ee9&#39;)<\/p>\n<p>plt.title(&#39;\u6210\u7ee9\u7bb1\u7ebf\u56fe&#39;)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u7ed8\u5236\u6563\u70b9\u56fe<\/h4>\n<\/p>\n<p><p>\u6563\u70b9\u56fe\u7528\u4e8e\u5c55\u793a\u4e24\u4e2a\u53d8\u91cf\u4e4b\u95f4\u7684\u5173\u7cfb\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528matplotlib\u5e93\u6765\u7ed8\u5236\u6563\u70b9\u56fe\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u7ed8\u5236\u6563\u70b9\u56fe<\/p>\n<p>plt.scatter(data[&#39;study_hours&#39;], data[&#39;score&#39;])<\/p>\n<p>plt.xlabel(&#39;\u5b66\u4e60\u65f6\u95f4&#39;)<\/p>\n<p>plt.ylabel(&#39;\u6210\u7ee9&#39;)<\/p>\n<p>plt.title(&#39;\u5b66\u4e60\u65f6\u95f4\u4e0e\u6210\u7ee9\u7684\u5173\u7cfb&#39;)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u56de\u5f52\u5206\u6790<\/h3>\n<\/p>\n<p><p>\u56de\u5f52\u5206\u6790\u662f\u5efa\u7acb\u81ea\u53d8\u91cf\u4e0e\u56e0\u53d8\u91cf\u4e4b\u95f4\u7684\u5173\u7cfb\u6a21\u578b\uff0c\u4f8b\u5982\u7ebf\u6027\u56de\u5f52\u3001\u903b\u8f91\u56de\u5f52\u7b49\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528scikit-learn\u5e93\u6765\u8fdb\u884c\u56de\u5f52\u5206\u6790\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u7ebf\u6027\u56de\u5f52<\/h4>\n<\/p>\n<p><p>\u7ebf\u6027\u56de\u5f52\u7528\u4e8e\u5efa\u7acb\u81ea\u53d8\u91cf\u4e0e\u56e0\u53d8\u91cf\u4e4b\u95f4\u7684\u7ebf\u6027\u5173\u7cfb\u6a21\u578b\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528scikit-learn\u5e93\u6765\u8fdb\u884c\u7ebf\u6027\u56de\u5f52\u5206\u6790\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sklearn.model_selection import tr<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n_test_split<\/p>\n<p>from sklearn.linear_model import LinearRegression<\/p>\n<h2><strong>\u5212\u5206\u8bad\u7ec3\u96c6\u548c\u6d4b\u8bd5\u96c6<\/strong><\/h2>\n<p>X = data[[&#39;study_hours&#39;]]<\/p>\n<p>y = data[&#39;score&#39;]<\/p>\n<p>X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)<\/p>\n<h2><strong>\u5efa\u7acb\u7ebf\u6027\u56de\u5f52\u6a21\u578b<\/strong><\/h2>\n<p>model = LinearRegression()<\/p>\n<p>model.fit(X_train, y_train)<\/p>\n<h2><strong>\u9884\u6d4b<\/strong><\/h2>\n<p>y_pred = model.predict(X_test)<\/p>\n<h2><strong>\u8bc4\u4f30\u6a21\u578b<\/strong><\/h2>\n<p>from sklearn.metrics import mean_squared_error, r2_score<\/p>\n<p>mse = mean_squared_error(y_test, y_pred)<\/p>\n<p>r2 = r2_score(y_test, y_pred)<\/p>\n<p>print(&quot;\u5747\u65b9\u8bef\u5dee: &quot;, mse)<\/p>\n<p>print(&quot;R\u5e73\u65b9: &quot;, r2)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u903b\u8f91\u56de\u5f52<\/h4>\n<\/p>\n<p><p>\u903b\u8f91\u56de\u5f52\u7528\u4e8e\u5efa\u7acb\u81ea\u53d8\u91cf\u4e0e\u56e0\u53d8\u91cf\u4e4b\u95f4\u7684\u4e8c\u5206\u7c7b\u5173\u7cfb\u6a21\u578b\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528scikit-learn\u5e93\u6765\u8fdb\u884c\u903b\u8f91\u56de\u5f52\u5206\u6790\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sklearn.linear_model import LogisticRegression<\/p>\n<h2><strong>\u76ee\u6807\u53d8\u91cf\u4e8c\u5206\u7c7b<\/strong><\/h2>\n<p>data[&#39;pass&#39;] = data[&#39;score&#39;].apply(lambda x: 1 if x &gt;= 60 else 0)<\/p>\n<h2><strong>\u5212\u5206\u8bad\u7ec3\u96c6\u548c\u6d4b\u8bd5\u96c6<\/strong><\/h2>\n<p>X = data[[&#39;study_hours&#39;]]<\/p>\n<p>y = data[&#39;pass&#39;]<\/p>\n<p>X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)<\/p>\n<h2><strong>\u5efa\u7acb\u903b\u8f91\u56de\u5f52\u6a21\u578b<\/strong><\/h2>\n<p>model = LogisticRegression()<\/p>\n<p>model.fit(X_train, y_train)<\/p>\n<h2><strong>\u9884\u6d4b<\/strong><\/h2>\n<p>y_pred = model.predict(X_test)<\/p>\n<h2><strong>\u8bc4\u4f30\u6a21\u578b<\/strong><\/h2>\n<p>from sklearn.metrics import accuracy_score, confusion_matrix, classification_report<\/p>\n<p>accuracy = accuracy_score(y_test, y_pred)<\/p>\n<p>conf_matrix = confusion_matrix(y_test, y_pred)<\/p>\n<p>class_report = classification_report(y_test, y_pred)<\/p>\n<p>print(&quot;\u51c6\u786e\u7387: &quot;, accuracy)<\/p>\n<p>print(&quot;\u6df7\u6dc6\u77e9\u9635: \\n&quot;, conf_matrix)<\/p>\n<p>print(&quot;\u5206\u7c7b\u62a5\u544a: \\n&quot;, class_report)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u7ed3\u8bba<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u5bf9\u8003\u8bd5\u6210\u7ee9\u8fdb\u884c\u5168\u9762\u5206\u6790\u3002\u4ece\u6570\u636e\u9884\u5904\u7406\u5f00\u59cb\uff0c\u4fdd\u8bc1\u6570\u636e\u8d28\u91cf\uff0c\u7136\u540e\u8fdb\u884c\u7edf\u8ba1\u5206\u6790\u548c\u53ef\u89c6\u5316\u5206\u6790\uff0c\u53d1\u73b0\u6570\u636e\u7279\u5f81\u548c\u89c4\u5f8b\uff0c\u6700\u540e\u901a\u8fc7\u56de\u5f52\u5206\u6790\u5efa\u7acb\u53d8\u91cf\u5173\u7cfb\u6a21\u578b\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7406\u89e3\u548c\u5e94\u7528Python\u8fdb\u884c\u8003\u8bd5\u6210\u7ee9\u5206\u6790\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u5bf9\u8003\u8bd5\u6210\u7ee9\u8fdb\u884c\u53ef\u89c6\u5316\u5206\u6790\uff1f<\/strong><br \/>\u4f7f\u7528Python\u8fdb\u884c\u8003\u8bd5\u6210\u7ee9\u7684\u53ef\u89c6\u5316\u5206\u6790\u53ef\u4ee5\u501f\u52a9Matplotlib\u548cSeaborn\u7b49\u5e93\u3002\u901a\u8fc7\u7ed8\u5236\u76f4\u65b9\u56fe\u3001\u7bb1\u7ebf\u56fe\u548c\u6563\u70b9\u56fe\u7b49\uff0c\u53ef\u4ee5\u76f4\u89c2\u5c55\u793a\u6210\u7ee9\u5206\u5e03\u3001\u96c6\u4e2d\u8d8b\u52bf\u53ca\u79bb\u6563\u7a0b\u5ea6\u3002\u6b64\u5916\uff0c\u4f7f\u7528Pandas\u5e93\u53ef\u4ee5\u4fbf\u6377\u5730\u5904\u7406\u6570\u636e\uff0c\u751f\u6210\u7edf\u8ba1\u56fe\u8868\uff0c\u5e2e\u52a9\u6211\u4eec\u66f4\u597d\u5730\u7406\u89e3\u6210\u7ee9\u80cc\u540e\u7684\u8d8b\u52bf\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\u5982\u4f55\u5904\u7406\u7f3a\u5931\u7684\u8003\u8bd5\u6210\u7ee9\u6570\u636e\uff1f<\/strong><br \/>\u5728\u6570\u636e\u5206\u6790\u4e2d\uff0c\u7f3a\u5931\u503c\u662f\u4e00\u4e2a\u5e38\u89c1\u7684\u95ee\u9898\u3002\u4f7f\u7528Pandas\u5e93\u4e2d\u7684<code>isnull()<\/code>\u51fd\u6570\u53ef\u4ee5\u5feb\u901f\u8bc6\u522b\u7f3a\u5931\u503c\u3002\u9488\u5bf9\u7f3a\u5931\u6570\u636e\uff0c\u53ef\u4ee5\u9009\u62e9\u586b\u5145\uff08\u5982\u5747\u503c\u3001\u4e2d\u4f4d\u6570\u6216\u4f17\u6570\u586b\u5145\uff09\u6216\u8005\u5220\u9664\u7f3a\u5931\u884c\u3002\u6839\u636e\u5177\u4f53\u60c5\u51b5\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\uff0c\u4ee5\u786e\u4fdd\u5206\u6790\u7ed3\u679c\u7684\u51c6\u786e\u6027\u3002<\/p>\n<p><strong>\u6709\u54ea\u4e9bPython\u5e93\u9002\u5408\u8fdb\u884c\u8003\u8bd5\u6210\u7ee9\u7684\u7edf\u8ba1\u5206\u6790\uff1f<\/strong><br \/>\u8fdb\u884c\u8003\u8bd5\u6210\u7ee9\u7684\u7edf\u8ba1\u5206\u6790\u65f6\uff0cPandas\u3001NumPy\u548cSciPy\u662f\u975e\u5e38\u5b9e\u7528\u7684\u5e93\u3002Pandas\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u6570\u636e\u5904\u7406\u80fd\u529b\uff0cNumPy\u9002\u7528\u4e8e\u6570\u503c\u8ba1\u7b97\uff0c\u800cSciPy\u5219\u5305\u542b\u4e86\u8bb8\u591a\u7edf\u8ba1\u5206\u6790\u7684\u529f\u80fd\u3002\u6b64\u5916\uff0cStatsmodels\u5e93\u4e5f\u53ef\u4ee5\u7528\u4e8e\u8fdb\u884c\u66f4\u590d\u6742\u7684\u7edf\u8ba1\u5efa\u6a21\uff0c\u5e2e\u52a9\u6df1\u5165\u5206\u6790\u6210\u7ee9\u6570\u636e\u7684\u76f8\u5173\u6027\u4e0e\u56de\u5f52\u5206\u6790\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u4f7f\u7528Python\u5bf9\u8003\u8bd5\u6210\u7ee9\u8fdb\u884c\u5206\u6790\u7684\u6838\u5fc3\u65b9\u6cd5\u6709\uff1a\u6570\u636e\u9884\u5904\u7406\u3001\u7edf\u8ba1\u5206\u6790\u3001\u53ef\u89c6\u5316\u5206\u6790\u3001\u56de\u5f52\u5206\u6790\u3002 \u5176\u4e2d\uff0c\u6570\u636e\u9884\u5904\u7406 [&hellip;]","protected":false},"author":3,"featured_media":1102196,"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\/1102177"}],"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=1102177"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1102177\/revisions"}],"predecessor-version":[{"id":1102198,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1102177\/revisions\/1102198"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1102196"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1102177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1102177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1102177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}