{"id":1010290,"date":"2024-12-27T11:19:38","date_gmt":"2024-12-27T03:19:38","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1010290.html"},"modified":"2024-12-27T11:19:40","modified_gmt":"2024-12-27T03:19:40","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python%e6%b8%85%e6%b4%97%e6%95%b0%e6%8d%ae","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1010290.html","title":{"rendered":"\u5982\u4f55\u7528python\u6e05\u6d17\u6570\u636e"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25084858\/3e0469ca-b456-4ee8-8397-466fdaab57eb.webp\" alt=\"\u5982\u4f55\u7528python\u6e05\u6d17\u6570\u636e\" \/><\/p>\n<p><p> \u5728\u6570\u636e\u79d1\u5b66\u9886\u57df\u4e2d\uff0c\u6570\u636e\u6e05\u6d17\u662f\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u6b65\u9aa4\uff0c\u5b83\u76f4\u63a5\u5f71\u54cd\u5230\u6570\u636e\u5206\u6790\u548c\u6a21\u578b\u7684\u8d28\u91cf\u3002<strong>\u4f7f\u7528Python\u8fdb\u884c\u6570\u636e\u6e05\u6d17\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u5bfc\u5165\u6570\u636e\u3001\u5904\u7406\u7f3a\u5931\u503c\u3001\u5220\u9664\u91cd\u590d\u6570\u636e\u3001\u6570\u636e\u7c7b\u578b\u8f6c\u6362\u3001\u5904\u7406\u5f02\u5e38\u503c\u3001\u6807\u51c6\u5316\u548c\u5f52\u4e00\u5316\u6570\u636e<\/strong>\u3002\u8fd9\u4e9b\u6b65\u9aa4\u786e\u4fdd\u4e86\u6570\u636e\u7684\u5b8c\u6574\u6027\u548c\u4e00\u81f4\u6027\uff0c\u63d0\u9ad8\u4e86\u6570\u636e\u5206\u6790\u7684\u51c6\u786e\u6027\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u8fd9\u4e9b\u6b65\u9aa4\u4e2d\u7684\u6bcf\u4e00\u6b65\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u5bfc\u5165\u6570\u636e<\/p>\n<\/p>\n<p><p>\u5728\u8fdb\u884c\u6570\u636e\u6e05\u6d17\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u5c06\u6570\u636e\u5bfc\u5165Python\u73af\u5883\u4e2d\u3002\u5e38\u7528\u7684\u6570\u636e\u683c\u5f0f\u5305\u62ecCSV\u3001Excel\u3001SQL\u6570\u636e\u5e93\u7b49\u3002Python\u7684pandas\u5e93\u975e\u5e38\u5f3a\u5927\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5904\u7406\u8fd9\u4e9b\u6570\u636e\u683c\u5f0f\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528pandas\u8bfb\u53d6CSV\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>CSV\u6587\u4ef6\u662f\u6700\u5e38\u89c1\u7684\u6570\u636e\u683c\u5f0f\u4e4b\u4e00\u3002\u4f7f\u7528pandas\u7684<code>read_csv()<\/code>\u51fd\u6570\u53ef\u4ee5\u8f7b\u677e\u8bfb\u53d6CSV\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p>data = pd.read_csv(&#39;data.csv&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8bfb\u53d6Excel\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>Excel\u6587\u4ef6\u4e5f\u662f\u5e38\u7528\u7684\u6570\u636e\u5b58\u50a8\u683c\u5f0f\u3002\u53ef\u4ee5\u4f7f\u7528pandas\u7684<code>read_excel()<\/code>\u51fd\u6570\u8bfb\u53d6Excel\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = pd.read_excel(&#39;data.xlsx&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4eceSQL\u6570\u636e\u5e93\u8bfb\u53d6\u6570\u636e<\/strong><\/p>\n<\/p>\n<p><p>\u5982\u679c\u6570\u636e\u5b58\u50a8\u5728SQL\u6570\u636e\u5e93\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528SQLAlchemy\u5e93\u4e0epandas\u7ed3\u5408\uff0c\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sqlalchemy import create_engine<\/p>\n<p>engine = create_engine(&#39;sqlite:\/\/\/:memory:&#39;)<\/p>\n<p>data = pd.read_sql(&#39;SELECT * FROM table_name&#39;, engine)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u5904\u7406\u7f3a\u5931\u503c<\/p>\n<\/p>\n<p><p>\u7f3a\u5931\u503c\u5728\u6570\u636e\u96c6\u4e2d\u662f\u5f88\u5e38\u89c1\u7684\uff0c\u5b83\u4eec\u53ef\u80fd\u4f1a\u5f71\u54cd\u6570\u636e\u5206\u6790\u7684\u7ed3\u679c\u3002\u56e0\u6b64\uff0c\u9700\u8981\u5bf9\u7f3a\u5931\u503c\u8fdb\u884c\u5904\u7406\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u68c0\u6d4b\u7f3a\u5931\u503c<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528pandas\u7684<code>isnull()<\/code>\u51fd\u6570\u53ef\u4ee5\u68c0\u6d4b\u6570\u636e\u4e2d\u7684\u7f3a\u5931\u503c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">missing_values = data.isnull().sum()<\/p>\n<p>print(missing_values)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5220\u9664\u542b\u6709\u7f3a\u5931\u503c\u7684\u884c\u6216\u5217<\/strong><\/p>\n<\/p>\n<p><p>\u5bf9\u4e8e\u7f3a\u5931\u503c\u8f83\u591a\u7684\u884c\u6216\u5217\uff0c\u53ef\u4ee5\u9009\u62e9\u5220\u9664\u3002\u4f7f\u7528<code>dropna()<\/code>\u51fd\u6570\u53ef\u4ee5\u5b9e\u73b0\u8fd9\u4e00\u70b9\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data_cleaned = data.dropna(axis=0)  # \u5220\u9664\u542b\u6709\u7f3a\u5931\u503c\u7684\u884c<\/p>\n<p>data_cleaned = data.dropna(axis=1)  # \u5220\u9664\u542b\u6709\u7f3a\u5931\u503c\u7684\u5217<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u586b\u5145\u7f3a\u5931\u503c<\/strong><\/p>\n<\/p>\n<p><p>\u5bf9\u4e8e\u7f3a\u5931\u503c\u8f83\u5c11\u7684\u60c5\u51b5\uff0c\u53ef\u4ee5\u9009\u62e9\u586b\u5145\u7f3a\u5931\u503c\u3002\u53ef\u4ee5\u4f7f\u7528\u5747\u503c\u3001\u4e2d\u4f4d\u6570\u6216\u8005\u5176\u4ed6\u65b9\u6cd5\u8fdb\u884c\u586b\u5145\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data[&#39;column_name&#39;].fillna(data[&#39;column_name&#39;].mean(), inplace=True)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u5220\u9664\u91cd\u590d\u6570\u636e<\/p>\n<\/p>\n<p><p>\u91cd\u590d\u6570\u636e\u4f1a\u5bfc\u81f4\u5206\u6790\u7ed3\u679c\u7684\u504f\u5dee\uff0c\u56e0\u6b64\u9700\u8981\u5220\u9664\u91cd\u590d\u7684\u6570\u636e\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u68c0\u6d4b\u91cd\u590d\u6570\u636e<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528pandas\u7684<code>duplicated()<\/code>\u51fd\u6570\u53ef\u4ee5\u68c0\u6d4b\u91cd\u590d\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">duplicates = data.duplicated()<\/p>\n<p>print(duplicates.sum())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5220\u9664\u91cd\u590d\u6570\u636e<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>drop_duplicates()<\/code>\u51fd\u6570\u53ef\u4ee5\u5220\u9664\u91cd\u590d\u7684\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data_cleaned = data.drop_duplicates()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u6570\u636e\u7c7b\u578b\u8f6c\u6362<\/p>\n<\/p>\n<p><p>\u5728\u8fdb\u884c\u6570\u636e\u5206\u6790\u4e4b\u524d\uff0c\u9700\u8981\u786e\u4fdd\u6570\u636e\u7c7b\u578b\u7684\u6b63\u786e\u6027\u3002\u9519\u8bef\u7684\u6570\u636e\u7c7b\u578b\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5206\u6790\u7ed3\u679c\u4e0d\u51c6\u786e\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u68c0\u67e5\u6570\u636e\u7c7b\u578b<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528pandas\u7684<code>dtypes<\/code>\u5c5e\u6027\u53ef\u4ee5\u67e5\u770b\u6570\u636e\u7c7b\u578b\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(data.dtypes)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8f6c\u6362\u6570\u636e\u7c7b\u578b<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>astype()<\/code>\u51fd\u6570\u53ef\u4ee5\u8f6c\u6362\u6570\u636e\u7c7b\u578b\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data[&#39;column_name&#39;] = data[&#39;column_name&#39;].astype(&#39;float&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u5904\u7406\u5f02\u5e38\u503c<\/p>\n<\/p>\n<p><p>\u5f02\u5e38\u503c\u53ef\u80fd\u662f\u9519\u8bef\u7684\u6570\u636e\u8f93\u5165\uff0c\u4e5f\u53ef\u80fd\u662f\u6781\u7aef\u7684\u89c2\u6d4b\u503c\u3002\u5728\u5206\u6790\u4e2d\uff0c\u5f02\u5e38\u503c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u8bef\u5bfc\u7684\u7ed3\u679c\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u68c0\u6d4b\u5f02\u5e38\u503c<\/strong><\/p>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528\u63cf\u8ff0\u6027\u7edf\u8ba1\u6216\u8005\u53ef\u89c6\u5316\u65b9\u6cd5\u68c0\u6d4b\u5f02\u5e38\u503c\u3002\u4f7f\u7528pandas\u7684<code>describe()<\/code>\u51fd\u6570\u53ef\u4ee5\u67e5\u770b\u6570\u636e\u7684\u57fa\u672c\u7edf\u8ba1\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(data.describe())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u7bb1\u7ebf\u56fe\u53ef\u4ee5\u53ef\u89c6\u5316\u5f02\u5e38\u503c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>plt.boxplot(data[&#39;column_name&#39;])<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5904\u7406\u5f02\u5e38\u503c<\/strong><\/p>\n<\/p>\n<p><p>\u5bf9\u4e8e\u5f02\u5e38\u503c\uff0c\u53ef\u4ee5\u9009\u62e9\u5220\u9664\u6216\u66ff\u6362\u3002\u53ef\u4ee5\u4f7f\u7528\u6761\u4ef6\u7b5b\u9009\u5220\u9664\u5f02\u5e38\u503c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data_cleaned = data[data[&#39;column_name&#39;] &lt; threshold]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516d\u3001\u6807\u51c6\u5316\u548c\u5f52\u4e00\u5316\u6570\u636e<\/p>\n<\/p>\n<p><p>\u6807\u51c6\u5316\u548c\u5f52\u4e00\u5316\u662f\u5c06\u6570\u636e\u7f29\u653e\u5230\u4e00\u4e2a\u7279\u5b9a\u8303\u56f4\u7684\u8fc7\u7a0b\uff0c\u4ee5\u4fbf\u5728\u5206\u6790\u548c\u5efa\u6a21\u65f6\u5177\u6709\u66f4\u597d\u7684\u8868\u73b0\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6807\u51c6\u5316\u6570\u636e<\/strong><\/p>\n<\/p>\n<p><p>\u6807\u51c6\u5316\u662f\u5c06\u6570\u636e\u8f6c\u6362\u4e3a\u5747\u503c\u4e3a0\uff0c\u6807\u51c6\u5dee\u4e3a1\u7684\u8fc7\u7a0b\u3002\u53ef\u4ee5\u4f7f\u7528<code>StandardScaler<\/code>\u8fdb\u884c\u6807\u51c6\u5316\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sklearn.preprocessing import StandardScaler<\/p>\n<p>scaler = StandardScaler()<\/p>\n<p>data_standardized = scaler.fit_transform(data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5f52\u4e00\u5316\u6570\u636e<\/strong><\/p>\n<\/p>\n<p><p>\u5f52\u4e00\u5316\u662f\u5c06\u6570\u636e\u7f29\u653e\u5230[0, 1]\u8303\u56f4\u5185\u3002\u53ef\u4ee5\u4f7f\u7528<code>MinMaxScaler<\/code>\u8fdb\u884c\u5f52\u4e00\u5316\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sklearn.preprocessing import MinMaxScaler<\/p>\n<p>scaler = MinMaxScaler()<\/p>\n<p>data_normalized = scaler.fit_transform(data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e03\u3001\u7279\u5f81\u5de5\u7a0b<\/p>\n<\/p>\n<p><p>\u7279\u5f81\u5de5\u7a0b\u662f\u4ece\u539f\u59cb\u6570\u636e\u4e2d\u521b\u5efa\u65b0\u7684\u7279\u5f81\u4ee5\u63d0\u9ad8\u6a21\u578b\u6027\u80fd\u7684\u8fc7\u7a0b\u3002\u5e38\u89c1\u7684\u7279\u5f81\u5de5\u7a0b\u6280\u672f\u5305\u62ec\u7279\u5f81\u9009\u62e9\u3001\u7279\u5f81\u63d0\u53d6\u3001\u7279\u5f81\u7ec4\u5408\u7b49\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u7279\u5f81\u9009\u62e9<\/strong><\/p>\n<\/p>\n<p><p>\u7279\u5f81\u9009\u62e9\u662f\u9009\u62e9\u5bf9\u6a21\u578b\u6700\u6709\u7528\u7684\u7279\u5f81\u3002\u53ef\u4ee5\u4f7f\u7528<code>SelectKBest<\/code>\u9009\u62e9\u524dK\u4e2a\u6700\u91cd\u8981\u7684\u7279\u5f81\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sklearn.feature_selection import SelectKBest, f_classif<\/p>\n<p>selector = SelectKBest(score_func=f_classif, k=5)<\/p>\n<p>selected_features = selector.fit_transform(data, target)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7279\u5f81\u63d0\u53d6<\/strong><\/p>\n<\/p>\n<p><p>\u7279\u5f81\u63d0\u53d6\u662f\u4ece\u539f\u59cb\u6570\u636e\u4e2d\u63d0\u53d6\u65b0\u7684\u7279\u5f81\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e3b\u6210\u5206\u5206\u6790\uff08PCA\uff09\u8fdb\u884c\u7279\u5f81\u63d0\u53d6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sklearn.decomposition import PCA<\/p>\n<p>pca = PCA(n_components=2)<\/p>\n<p>principal_components = pca.fit_transform(data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7279\u5f81\u7ec4\u5408<\/strong><\/p>\n<\/p>\n<p><p>\u7279\u5f81\u7ec4\u5408\u662f\u901a\u8fc7\u7ec4\u5408\u73b0\u6709\u7279\u5f81\u521b\u5efa\u65b0\u7279\u5f81\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u901a\u8fc7\u5c06\u4e24\u4e2a\u7279\u5f81\u76f8\u4e58\u521b\u5efa\u65b0\u7684\u7279\u5f81\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data[&#39;new_feature&#39;] = data[&#39;feature1&#39;] * data[&#39;feature2&#39;]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516b\u3001\u7f16\u7801\u5206\u7c7b\u6570\u636e<\/p>\n<\/p>\n<p><p>\u5728\u6570\u636e\u96c6\u4e2d\uff0c\u5206\u7c7b\u6570\u636e\u9700\u8981\u8f6c\u6362\u4e3a\u6570\u503c\u5f62\u5f0f\uff0c\u4ee5\u4fbf\u7528\u4e8e\u5206\u6790\u548c\u5efa\u6a21\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6807\u7b7e\u7f16\u7801<\/strong><\/p>\n<\/p>\n<p><p>\u6807\u7b7e\u7f16\u7801\u662f\u5c06\u5206\u7c7b\u6570\u636e\u8f6c\u6362\u4e3a\u6574\u6570\u503c\u3002\u53ef\u4ee5\u4f7f\u7528<code>LabelEncoder<\/code>\u8fdb\u884c\u6807\u7b7e\u7f16\u7801\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sklearn.preprocessing import LabelEncoder<\/p>\n<p>encoder = LabelEncoder()<\/p>\n<p>data[&#39;category&#39;] = encoder.fit_transform(data[&#39;category&#39;])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u72ec\u70ed\u7f16\u7801<\/strong><\/p>\n<\/p>\n<p><p>\u72ec\u70ed\u7f16\u7801\u662f\u5c06\u5206\u7c7b\u6570\u636e\u8f6c\u6362\u4e3a\u4e8c\u8fdb\u5236\u5411\u91cf\u3002\u53ef\u4ee5\u4f7f\u7528pandas\u7684<code>get_dummies()<\/code>\u51fd\u6570\u8fdb\u884c\u72ec\u70ed\u7f16\u7801\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data_encoded = pd.get_dummies(data, columns=[&#39;category&#39;])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Python\u6709\u6548\u5730\u6e05\u6d17\u6570\u636e\u3002\u8fd9\u4e9b\u6280\u672f\u548c\u5de5\u5177\u5728\u6570\u636e\u79d1\u5b66\u548c<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u9879\u76ee\u4e2d\u81f3\u5173\u91cd\u8981\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u51c6\u5907\u9ad8\u8d28\u91cf\u7684\u6570\u636e\u4ee5\u8fdb\u884c\u8fdb\u4e00\u6b65\u7684\u5206\u6790\u548c\u5efa\u6a21\u3002\u6570\u636e\u6e05\u6d17\u867d\u7136\u662f\u4e00\u4e2a\u8017\u65f6\u7684\u8fc7\u7a0b\uff0c\u4f46\u5b83\u5bf9\u4e8e\u786e\u4fdd\u5206\u6790\u7ed3\u679c\u7684\u51c6\u786e\u6027\u548c\u53ef\u9760\u6027\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5728\u4f7f\u7528Python\u8fdb\u884c\u6570\u636e\u6e05\u6d17\u65f6\uff0c\u54ea\u4e9b\u5e93\u662f\u6700\u5e38\u7528\u7684\uff1f<\/strong><br \/>Python\u4e2d\u6709\u8bb8\u591a\u5f3a\u5927\u7684\u5e93\u53ef\u4ee5\u5e2e\u52a9\u6570\u636e\u6e05\u6d17\uff0c\u6700\u5e38\u7528\u7684\u5305\u62ecPandas\u3001NumPy\u548cBeautiful Soup\u3002Pandas\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u6570\u636e\u6846\u67b6\u548c\u6570\u636e\u64cd\u4f5c\u529f\u80fd\uff0c\u7279\u522b\u9002\u5408\u5904\u7406\u7ed3\u6784\u5316\u6570\u636e\u3002NumPy\u5219\u7528\u4e8e\u9ad8\u6548\u7684\u6570\u503c\u8ba1\u7b97\uff0c\u800cBeautiful Soup\u975e\u5e38\u9002\u5408\u7528\u4e8e\u89e3\u6790\u548c\u6e05\u6d17HTML\u548cXML\u6570\u636e\u3002<\/p>\n<p><strong>\u6570\u636e\u6e05\u6d17\u7684\u5e38\u89c1\u6b65\u9aa4\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\u6570\u636e\u6e05\u6d17\u901a\u5e38\u5305\u62ec\u591a\u4e2a\u6b65\u9aa4\uff0c\u4f8b\u5982\uff1a\u5904\u7406\u7f3a\u5931\u503c\u3001\u53bb\u9664\u91cd\u590d\u8bb0\u5f55\u3001\u6807\u51c6\u5316\u6570\u636e\u683c\u5f0f\u3001\u7b5b\u9009\u4e0d\u5fc5\u8981\u7684\u6570\u636e\u3001\u8f6c\u6362\u6570\u636e\u7c7b\u578b\u548c\u5904\u7406\u5f02\u5e38\u503c\u3002\u901a\u8fc7\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u53ef\u4ee5\u786e\u4fdd\u6570\u636e\u7684\u51c6\u786e\u6027\u548c\u4e00\u81f4\u6027\uff0c\u4ece\u800c\u4e3a\u540e\u7eed\u7684\u5206\u6790\u5960\u5b9a\u57fa\u7840\u3002<\/p>\n<p><strong>\u5982\u4f55\u5904\u7406\u6570\u636e\u4e2d\u7684\u7f3a\u5931\u503c\uff1f<\/strong><br \/>\u5904\u7406\u7f3a\u5931\u503c\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5e38\u89c1\u7684\u7b56\u7565\u5305\u62ec\u5220\u9664\u5305\u542b\u7f3a\u5931\u503c\u7684\u884c\u6216\u5217\uff0c\u586b\u5145\u7f3a\u5931\u503c\uff08\u4f8b\u5982\u4f7f\u7528\u5747\u503c\u3001\u4e2d\u4f4d\u6570\u6216\u4f17\u6570\uff09\uff0c\u6216\u4f7f\u7528\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u9884\u6d4b\u7f3a\u5931\u503c\u3002\u9009\u62e9\u4f55\u79cd\u65b9\u6cd5\u53d6\u51b3\u4e8e\u6570\u636e\u96c6\u7684\u7279\u6027\u548c\u5206\u6790\u76ee\u6807\uff0c\u56e0\u6b64\u9700\u8981\u8c28\u614e\u8003\u8651\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728\u6570\u636e\u79d1\u5b66\u9886\u57df\u4e2d\uff0c\u6570\u636e\u6e05\u6d17\u662f\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u6b65\u9aa4\uff0c\u5b83\u76f4\u63a5\u5f71\u54cd\u5230\u6570\u636e\u5206\u6790\u548c\u6a21\u578b\u7684\u8d28\u91cf\u3002\u4f7f\u7528Python\u8fdb\u884c\u6570\u636e\u6e05\u6d17 [&hellip;]","protected":false},"author":3,"featured_media":1010295,"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\/1010290"}],"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=1010290"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1010290\/revisions"}],"predecessor-version":[{"id":1010296,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1010290\/revisions\/1010296"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1010295"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1010290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1010290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1010290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}