{"id":172675,"date":"2024-05-08T17:55:20","date_gmt":"2024-05-08T09:55:20","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/172675.html"},"modified":"2024-05-08T17:55:26","modified_gmt":"2024-05-08T09:55:26","slug":"python%e8%83%bd%e5%81%9a%e6%95%b0%e6%8d%ae%e5%88%86%e6%9e%90%e5%90%97","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/172675.html","title":{"rendered":"python\u80fd\u505a\u6570\u636e\u5206\u6790\u5417"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/27044347\/9240458a-e489-4a71-bf49-72f9491ae5e7.webp\" alt=\"python\u80fd\u505a\u6570\u636e\u5206\u6790\u5417\" \/><\/p>\n<p><p>Python\u7edd\u5bf9\u662f\u6267\u884c\u6570\u636e\u5206\u6790\u7684\u5f3a\u5927\u5de5\u5177\uff0c\u5b83\u4e0d\u4ec5\u5177\u5907\u9ad8\u6548\u7387\u3001\u6613\u5b66\u6613\u7528\u7684\u7279\u6027\uff0c\u800c\u4e14\u8fd8\u62e5\u6709\u4e00\u4e2a\u5f3a\u5927\u7684\u5e93\u751f\u6001\u7cfb\u7edf\u3002<strong>Python\u5728\u6570\u636e\u5206\u6790\u4e2d\u7684\u5e94\u7528\u4e3b\u8981\u8868\u73b0\u5728\u6570\u636e\u6e05\u6d17\u3001\u6570\u636e\u63a2\u7d22\u3001\u6570\u636e\u53ef\u89c6\u5316\u4ee5\u53ca<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u7b49\u65b9\u9762\u3002<\/strong> \u5176\u4e2d\uff0c\u6570\u636e\u6e05\u6d17\u5c24\u4e3a\u5173\u952e\uff0c\u5b83\u662f\u6570\u636e\u5206\u6790\u8fc7\u7a0b\u4e2d\u7684\u7b2c\u4e00\u6b65\uff0c\u6d89\u53ca\u53bb\u9664\u6216\u4fee\u6b63\u6570\u636e\u96c6\u4e2d\u7684\u9519\u8bef\u3001\u91cd\u590d\u6216\u4e0d\u5b8c\u6574\u7684\u6570\u636e\u3002\u901a\u8fc7Python\u5f3a\u5927\u7684\u5e93\uff0c\u5982Pandas\u548cNumPy\uff0c\u8fd9\u4e00\u8fc7\u7a0b\u53d8\u5f97\u5f02\u5e38\u7b80\u5355\u9ad8\u6548\u3002Pandas\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6570\u636e\u7ed3\u6784\u548c\u51fd\u6570\uff0c\u8ba9\u6570\u636e\u6e05\u6d17\u3001\u5904\u7406\u53d8\u5f97\u8f7b\u677e\u800c\u76f4\u89c2\uff0c\u5927\u5927\u63d0\u5347\u4e86\u6570\u636e\u5206\u6790\u7684\u6548\u7387\u548c\u8d28\u91cf\u3002<\/p>\n<\/p>\n<p><h3><strong>\u4e00\u3001\u6570\u636e\u6e05\u6d17<\/strong><\/h3>\n<\/p>\n<p><p>\u5728\u6570\u636e\u5206\u6790\u4e4b\u524d\uff0c\u6570\u636e\u6e05\u6d17\u662f\u4e0d\u53ef\u6216\u7f3a\u7684\u4e00\u6b65\u3002\u4e0d\u5e72\u51c0\u7684\u6570\u636e\u4f1a\u76f4\u63a5\u5f71\u54cd\u5206\u6790\u7ed3\u679c\u7684\u51c6\u786e\u6027\u3002\u800cPython\u62e5\u6709\u5f3a\u5927\u7684\u6570\u636e\u5904\u7406\u5e93Pandas\uff0c\u63d0\u4f9b\u4e86DataFrame\u5bf9\u8c61\uff0c\u4fbf\u4e8e\u8fdb\u884c\u5404\u79cd\u6570\u636e\u6e05\u6d17\u64cd\u4f5c\u3002\u6bd4\u5982\uff0c\u5904\u7406\u7f3a\u5931\u503c\u3001\u5220\u9664\u91cd\u590d\u6570\u636e\u3001\u6570\u636e\u7c7b\u578b\u8f6c\u6362\u4ee5\u53ca\u6570\u636e\u8fc7\u6ee4\u7b49\u3002\u901a\u8fc7\u7b80\u5355\u7684\u51fd\u6570\u8c03\u7528\u5c31\u53ef\u4ee5\u5b8c\u6210\u8fd9\u4e9b\u590d\u6742\u7684\u6570\u636e\u5904\u7406\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><p>Pandas\u7684<code>dropna()<\/code>\u51fd\u6570\u53ef\u4ee5\u65b9\u4fbf\u5730\u53bb\u9664\u6570\u636e\u4e2d\u7684\u7f3a\u5931\u503c\uff0c\u800c<code>duplicated()<\/code>\u548c<code>drop_duplicates()<\/code>\u51fd\u6570\u5219\u53ef\u7528\u4e8e\u8bc6\u522b\u548c\u5220\u9664\u91cd\u590d\u7684\u6570\u636e\u6761\u76ee\u3002\u6b64\u5916\uff0cPandas\u8fd8\u652f\u6301\u901a\u8fc7\u6761\u4ef6\u903b\u8f91\u5bf9\u6570\u636e\u8fdb\u884c\u7b5b\u9009\uff0c\u8fd9\u5728\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u96c6\u65f6\u663e\u5f97\u5c24\u5176\u91cd\u8981\u3002<\/p>\n<\/p>\n<p><h3><strong>\u4e8c\u3001\u6570\u636e\u63a2\u7d22<\/strong><\/h3>\n<\/p>\n<p><p>\u6570\u636e\u63a2\u7d22\u662f\u4e86\u89e3\u6570\u636e\u96c6\u7684\u57fa\u672c\u60c5\u51b5\uff0c\u5e76\u4ece\u4e2d\u53d1\u73b0\u6f5c\u5728\u89c4\u5f8b\u6216\u6d1e\u5bdf\u7684\u8fc7\u7a0b\u3002Python\u4e3a\u6570\u636e\u63a2\u7d22\u63d0\u4f9b\u4e86\u8bf8\u5982Matplotlib\u3001Seaborn\u4ee5\u53caPandas\u81ea\u8eab\u7684\u7ed8\u56fe\u529f\u80fd\uff0c\u652f\u6301\u751f\u6210\u5404\u79cd\u76f4\u89c2\u7684\u56fe\u8868\uff0c\u5e2e\u52a9\u5206\u6790\u5e08\u66f4\u597d\u5730\u7406\u89e3\u6570\u636e\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u53ef\u89c6\u5316\u624b\u6bb5\uff0c\u6570\u636e\u5206\u6790\u5e08\u53ef\u4ee5\u5feb\u901f\u8bc6\u522b\u6570\u636e\u4e2d\u7684\u5f02\u5e38\u503c\u3001\u8d8b\u52bf\u4ee5\u53ca\u6a21\u5f0f\u7b49\u3002\u4f8b\u5982\uff0c\u6563\u70b9\u56fe\u53ef\u7528\u4e8e\u89c2\u6d4b\u4e24\u4e2a\u53d8\u91cf\u4e4b\u95f4\u7684\u5173\u7cfb\uff0c\u76f4\u65b9\u56fe\u5219\u9002\u7528\u4e8e\u67e5\u770b\u5355\u4e2a\u53d8\u91cf\u7684\u5206\u5e03\u60c5\u51b5\u3002Python\u7684\u8fd9\u4e9b\u56fe\u8868\u5de5\u5177\u90fd\u652f\u6301\u9ad8\u5ea6\u81ea\u5b9a\u4e49\uff0c\u4ece\u800c\u53ef\u4ee5\u751f\u6210\u5177\u6709\u4e30\u5bcc\u4fe1\u606f\u7684\u56fe\u8868\u3002<\/p>\n<\/p>\n<p><h3><strong>\u4e09\u3001\u6570\u636e\u53ef\u89c6\u5316<\/strong><\/h3>\n<\/p>\n<p><p>\u6570\u636e\u53ef\u89c6\u5316\u662f\u5c06\u6570\u636e\u901a\u8fc7\u56fe\u8868\u3001\u56fe\u5f62\u7b49\u5f62\u5f0f\u76f4\u89c2\u663e\u793a\u51fa\u6765\u7684\u8fc7\u7a0b\uff0c\u5bf9\u4e8e\u7406\u89e3\u590d\u6742\u6570\u636e\u548c\u5206\u6790\u7ed3\u679c\u6709\u7740\u6781\u5176\u91cd\u8981\u7684\u4f5c\u7528\u3002Python\u7684Matplotlib\u548cSeaborn\u5e93\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u6570\u636e\u53ef\u89c6\u5316\u529f\u80fd\uff0c\u80fd\u591f\u521b\u5efa\u4e30\u5bcc\u591a\u6837\u7684\u56fe\u8868\u548c\u56fe\u5f62\u3002<\/p>\n<\/p>\n<p><p>Matplotlib\u662fPython\u4e2d\u6700\u57fa\u7840\u7684\u7ed8\u56fe\u5e93\uff0c\u652f\u6301\u591a\u79cd\u56fe\u8868\u7684\u7ed8\u5236\uff0c\u5982\u66f2\u7ebf\u56fe\u3001\u6761\u5f62\u56fe\u3001\u6563\u70b9\u56fe\u7b49\u3002Seaborn\u5219\u5efa\u7acb\u5728Matplotlib\u7684\u57fa\u7840\u4e0a\uff0c\u63d0\u4f9b\u4e86\u66f4\u52a0\u9ad8\u7ea7\u7684\u53ef\u89c6\u5316\u529f\u80fd\uff0c\u6bd4\u5982\u7ed8\u5236\u70ed\u529b\u56fe\u3001\u5bf9\u6570\u56fe\u7b49\uff0c\u4f7f\u5f97\u6570\u636e\u5206\u6790\u5e08\u80fd\u591f\u66f4\u52a0\u6df1\u5165\u5730\u6316\u6398\u6570\u636e\u4e2d\u7684\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h3><strong>\u56db\u3001\u673a\u5668\u5b66\u4e60<\/strong><\/h3>\n<\/p>\n<p><p>Python\u5728\u673a\u5668\u5b66\u4e60\u9886\u57df\u540c\u6837\u5c55\u73b0\u51fa\u4e86\u5353\u8d8a\u7684\u80fd\u529b\u3002\u5229\u7528Python\u7684\u673a\u5668\u5b66\u4e60\u5e93\uff0c\u5982scikit-learn\u3001TensorFlow\u548cPyTorch\uff0c\u6570\u636e\u5206\u6790\u5e08\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u4ece\u6570\u636e\u9884\u5904\u7406\u3001\u7279\u5f81\u9009\u62e9\u5230\u6a21\u578b\u8bad\u7ec3\u548c\u8bc4\u4f30\u7684\u6574\u4e2a\u673a\u5668\u5b66\u4e60\u6d41\u7a0b\u3002<\/p>\n<\/p>\n<p><p>Scikit-learn\u5e93\u63d0\u4f9b\u4e86\u5927\u91cf\u7b80\u5355\u6613\u7528\u7684\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\uff0c\u5305\u62ec\u5206\u7c7b\u3001\u56de\u5f52\u3001\u805a\u7c7b\u4ee5\u53ca\u964d\u7ef4\u7b49\uff0c\u9002\u7528\u4e8e\u5904\u7406\u5404\u79cd\u6570\u636e\u5206\u6790\u95ee\u9898\u3002\u800cTensorFlow\u548cPyTorch\u5219\u662f\u5728\u6df1\u5ea6\u5b66\u4e60\u9886\u57df\u5e7f\u53d7\u6b22\u8fce\u7684\u6846\u67b6\uff0c\u5b83\u4eec\u652f\u6301\u590d\u6742\u7684\u7f51\u7edc\u7ed3\u6784\u548c\u7b97\u6cd5\uff0c\u4f7f\u5f97\u5904\u7406\u9ad8\u7ef4\u5ea6\u6570\u636e\u548c\u5b9e\u73b0\u66f4\u590d\u6742\u7684\u6570\u636e\u6a21\u578b\u6210\u4e3a\u53ef\u80fd\u3002<\/p>\n<\/p>\n<p><h3><strong>\u4e94\u3001\u603b\u7ed3<\/strong><\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u5206\u6790\uff0c\u4e0d\u96be\u53d1\u73b0\uff0cPython\u4e0d\u4ec5\u80fd\u591f\u8fdb\u884c\u6570\u636e\u5206\u6790\uff0c\u800c\u4e14\u5728\u8fd9\u4e00\u9886\u57df\u8868\u73b0\u5353\u8d8a\u3002\u5b83\u7684\u9ad8\u6548\u7387\u3001\u5f3a\u5927\u7684\u5e93\u751f\u6001\u7cfb\u7edf\u3001\u4ee5\u53ca\u4e30\u5bcc\u7684\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u5e93\uff0c\u90fd\u4f7f\u5f97Python\u6210\u4e3a\u6570\u636e\u79d1\u5b66\u5bb6\u7684\u9996\u9009\u8bed\u8a00\u3002\u65e0\u8bba\u662f\u5728\u6570\u636e\u6e05\u6d17\u3001\u6570\u636e\u63a2\u7d22\u3001\u6570\u636e\u53ef\u89c6\u5316\u8fd8\u662f\u673a\u5668\u5b66\u4e60\u7b49\u591a\u4e2a\u9636\u6bb5\uff0cPython\u90fd\u80fd\u63d0\u4f9b\u5f3a\u6709\u529b\u7684\u652f\u6301\uff0c\u5e2e\u52a9\u6570\u636e\u5206\u6790\u5e08\u9ad8\u6548\u3001\u51c6\u786e\u5730\u5b8c\u6210\u6570\u636e\u5904\u7406\u548c\u5206\u6790\u4efb\u52a1\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. Python\u5728\u6570\u636e\u5206\u6790\u4e2d\u6709\u54ea\u4e9b\u5e94\u7528\u573a\u666f\uff1f<\/strong><br \/>\nPython\u5728\u6570\u636e\u5206\u6790\u9886\u57df\u6709\u7740\u5e7f\u6cdb\u7684\u5e94\u7528\u573a\u666f\u3002\u5b83\u53ef\u4ee5\u7528\u4e8e\u6570\u636e\u6e05\u6d17\u3001\u6570\u636e\u5904\u7406\u3001\u6570\u636e\u53ef\u89c6\u5316\u4ee5\u53ca\u673a\u5668\u5b66\u4e60\u7b49\u5404\u4e2a\u9636\u6bb5\u548c\u4efb\u52a1\u3002\u4f8b\u5982\uff0c\u4f7f\u7528Python\u7684pandas\u5e93\u53ef\u4ee5\u9ad8\u6548\u5730\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u96c6\uff0cnumpy\u5e93\u53ef\u4ee5\u8fdb\u884c\u6570\u503c\u8ba1\u7b97\uff0cmatplotlib\u548cseaborn\u5e93\u53ef\u4ee5\u7ed8\u5236\u5404\u79cd\u7c7b\u578b\u7684\u6570\u636e\u53ef\u89c6\u5316\u56fe\u8868\u3002<\/p>\n<p><strong>2. Python\u6709\u54ea\u4e9b\u5e38\u7528\u7684\u6570\u636e\u5206\u6790\u5e93\u548c\u5de5\u5177\uff1f<\/strong><br \/>\nPython\u62e5\u6709\u4f17\u591a\u5f3a\u5927\u7684\u6570\u636e\u5206\u6790\u5e93\u548c\u5de5\u5177\uff0c\u5176\u4e2d\u6700\u5e38\u7528\u7684\u5305\u62ec\uff1apandas\u3001numpy\u3001matplotlib\u3001seaborn\u3001scikit-learn\u7b49\u3002\u8fd9\u4e9b\u5e93\u63d0\u4f9b\u4e86\u4e00\u7cfb\u5217\u51fd\u6570\u548c\u65b9\u6cd5\uff0c\u4f7f\u5f97\u5728Python\u4e2d\u8fdb\u884c\u6570\u636e\u5206\u6790\u53d8\u5f97\u66f4\u52a0\u9ad8\u6548\u548c\u4fbf\u6377\u3002<\/p>\n<p><strong>3. Python\u76f8\u8f83\u4e8e\u5176\u4ed6\u7f16\u7a0b\u8bed\u8a00\u5728\u6570\u636e\u5206\u6790\u65b9\u9762\u7684\u4f18\u52bf\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\nPython\u5728\u6570\u636e\u5206\u6790\u9886\u57df\u6709\u7740\u663e\u8457\u7684\u4f18\u52bf\u3002\u9996\u5148\uff0cPython\u62e5\u6709\u4e30\u5bcc\u800c\u6210\u719f\u7684\u6570\u636e\u5206\u6790\u5e93\u548c\u5de5\u5177\uff0c\u53ef\u4ee5\u6ee1\u8db3\u5404\u7c7b\u6570\u636e\u5206\u6790\u9700\u6c42\u3002\u5176\u6b21\uff0cPython\u5177\u6709\u6613\u5b66\u6613\u7528\u7684\u7279\u70b9\uff0c\u8bed\u6cd5\u7b80\u5355\u6e05\u6670\uff0c\u4f7f\u5f97\u521d\u5b66\u8005\u53ef\u4ee5\u8fc5\u901f\u4e0a\u624b\u8fdb\u884c\u6570\u636e\u5206\u6790\u3002\u6b64\u5916\uff0cPython\u8fd8\u6709\u5f3a\u5927\u7684\u793e\u533a\u652f\u6301\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u83b7\u5f97\u5e2e\u52a9\u548c\u5206\u4eab\u7ecf\u9a8c\u3002\u6240\u6709\u8fd9\u4e9b\u56e0\u7d20\u4f7f\u5f97Python\u6210\u4e3a\u6570\u636e\u5206\u6790\u9886\u57df\u7684\u9996\u9009\u8bed\u8a00\u4e4b\u4e00\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u7edd\u5bf9\u662f\u6267\u884c\u6570\u636e\u5206\u6790\u7684\u5f3a\u5927\u5de5\u5177\uff0c\u5b83\u4e0d\u4ec5\u5177\u5907\u9ad8\u6548\u7387\u3001\u6613\u5b66\u6613\u7528\u7684\u7279\u6027\uff0c\u800c\u4e14\u8fd8\u62e5\u6709\u4e00\u4e2a\u5f3a\u5927\u7684\u5e93\u751f\u6001\u7cfb\u7edf\u3002P [&hellip;]","protected":false},"author":3,"featured_media":172688,"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\/172675"}],"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=172675"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/172675\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/172688"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=172675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=172675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=172675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}