{"id":1084898,"date":"2025-01-08T13:11:21","date_gmt":"2025-01-08T05:11:21","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1084898.html"},"modified":"2025-01-08T13:11:23","modified_gmt":"2025-01-08T05:11:23","slug":"python%e5%a6%82%e4%bd%95%e5%a4%84%e7%90%86%e4%b8%8a%e4%b8%87%e6%95%b0%e6%8d%ae-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1084898.html","title":{"rendered":"python\u5982\u4f55\u5904\u7406\u4e0a\u4e07\u6570\u636e"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24195035\/72cbcf1a-9fe2-4ffb-b8f3-40f29a62f184.webp\" alt=\"python\u5982\u4f55\u5904\u7406\u4e0a\u4e07\u6570\u636e\" \/><\/p>\n<p><p> Python\u5904\u7406\u4e0a\u4e07\u6570\u636e\u7684\u65b9\u6cd5\u4e3b\u8981\u5305\u62ec\uff1a\u4f7f\u7528\u9ad8\u6548\u7684\u6570\u636e\u7ed3\u6784\u3001\u8fd0\u7528\u5e76\u884c\u548c\u5206\u5e03\u5f0f\u8ba1\u7b97\u3001\u4f18\u5316\u4ee3\u7801\u6027\u80fd\u3002<strong>\u4f7f\u7528\u9ad8\u6548\u7684\u6570\u636e\u7ed3\u6784<\/strong>\uff0c\u5982NumPy\u6570\u7ec4\u548cPandas DataFrame\uff0c\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8\u6570\u636e\u5904\u7406\u7684\u901f\u5ea6\u548c\u6548\u7387\u3002NumPy\u548cPandas\u662f\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u7684\u7edd\u4f73\u9009\u62e9\uff0c\u56e0\u4e3a\u5b83\u4eec\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u5411\u91cf\u5316\u64cd\u4f5c\u548c\u5185\u7f6e\u7684\u4f18\u5316\u7b97\u6cd5\u3002<strong>\u8fd0\u7528\u5e76\u884c\u548c\u5206\u5e03\u5f0f\u8ba1\u7b97<\/strong>\uff0c\u5982\u4f7f\u7528\u591a\u7ebf\u7a0b\u3001\u591a\u8fdb\u7a0b\u4ee5\u53ca\u5206\u5e03\u5f0f\u8ba1\u7b97\u6846\u67b6\uff08\u5982Dask\u3001Ray\uff09\uff0c\u53ef\u4ee5\u8fdb\u4e00\u6b65\u63d0\u9ad8\u6570\u636e\u5904\u7406\u7684\u6548\u7387\u3002<strong>\u4f18\u5316\u4ee3\u7801\u6027\u80fd<\/strong>\uff0c\u901a\u8fc7\u4f7f\u7528\u5408\u9002\u7684\u7b97\u6cd5\u548c\u6570\u636e\u7ed3\u6784\uff0c\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u8ba1\u7b97\u5f00\u9500\u548c\u5185\u5b58\u5360\u7528\uff0c\u53ef\u4ee5\u663e\u8457\u63d0\u5347\u7a0b\u5e8f\u7684\u6267\u884c\u901f\u5ea6\u3002<\/p>\n<\/p>\n<p><p>\u4e0b\u9762\u6211\u4eec\u8be6\u7ec6\u8ba8\u8bba\u5176\u4e2d\u4e00\u4e2a\u65b9\u6cd5\u2014\u2014\u4f7f\u7528\u9ad8\u6548\u7684\u6570\u636e\u7ed3\u6784\u3002<\/p>\n<\/p>\n<p><p>NumPy\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u79d1\u5b66\u8ba1\u7b97\u5e93\uff0c\u4e13\u4e3a\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u800c\u8bbe\u8ba1\u3002\u5b83\u7684\u4e3b\u8981\u6570\u636e\u7ed3\u6784\u662f\u591a\u7ef4\u6570\u7ec4\uff08ndarray\uff09\uff0c\u63d0\u4f9b\u4e86\u5927\u91cf\u9ad8\u6548\u7684\u6570\u5b66\u51fd\u6570\u548c\u64cd\u4f5c\u3002\u76f8\u6bd4\u4e8ePython\u7684\u5185\u7f6e\u5217\u8868\uff0cNumPy\u6570\u7ec4\u5728\u5b58\u50a8\u548c\u64cd\u4f5c\u6570\u636e\u65b9\u9762\u5177\u6709\u663e\u8457\u7684\u6027\u80fd\u4f18\u52bf\u3002\u901a\u8fc7\u4f7f\u7528NumPy\u6570\u7ec4\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5411\u91cf\u5316\u64cd\u4f5c\uff0c\u4ece\u800c\u907f\u514d\u4f7f\u7528Python\u7684for\u5faa\u73af\uff0c\u5927\u5e45\u63d0\u9ad8\u8ba1\u7b97\u6548\u7387\u3002\u4f8b\u5982\uff0c\u4f7f\u7528NumPy\u6570\u7ec4\u5bf9\u4e24\u4e2a\u6570\u7ec4\u8fdb\u884c\u9010\u5143\u7d20\u52a0\u6cd5\u64cd\u4f5c\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<h2><strong>\u521b\u5efa\u4e24\u4e2aNumPy\u6570\u7ec4<\/strong><\/h2>\n<p>array1 = np.array([1, 2, 3, 4, 5])<\/p>\n<p>array2 = np.array([6, 7, 8, 9, 10])<\/p>\n<h2><strong>\u9010\u5143\u7d20\u52a0\u6cd5\u64cd\u4f5c<\/strong><\/h2>\n<p>result = array1 + array2<\/p>\n<p>print(result)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6837\uff0cNumPy\u4f1a\u81ea\u52a8\u8fdb\u884c\u9ad8\u6548\u7684\u5411\u91cf\u5316\u64cd\u4f5c\uff0c\u4f7f\u5f97\u8ba1\u7b97\u901f\u5ea6\u8fdc\u5feb\u4e8e\u666e\u901a\u7684Python\u5217\u8868\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528\u9ad8\u6548\u7684\u6570\u636e\u7ed3\u6784<\/h3>\n<\/p>\n<p><h4>1. NumPy\u6570\u7ec4<\/h4>\n<\/p>\n<p><p>NumPy\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u79d1\u5b66\u8ba1\u7b97\u5e93\uff0c\u4e13\u4e3a\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u800c\u8bbe\u8ba1\u3002\u5b83\u7684\u4e3b\u8981\u6570\u636e\u7ed3\u6784\u662f\u591a\u7ef4\u6570\u7ec4\uff08ndarray\uff09\uff0c\u63d0\u4f9b\u4e86\u5927\u91cf\u9ad8\u6548\u7684\u6570\u5b66\u51fd\u6570\u548c\u64cd\u4f5c\u3002\u76f8\u6bd4\u4e8ePython\u7684\u5185\u7f6e\u5217\u8868\uff0cNumPy\u6570\u7ec4\u5728\u5b58\u50a8\u548c\u64cd\u4f5c\u6570\u636e\u65b9\u9762\u5177\u6709\u663e\u8457\u7684\u6027\u80fd\u4f18\u52bf\u3002\u901a\u8fc7\u4f7f\u7528NumPy\u6570\u7ec4\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5411\u91cf\u5316\u64cd\u4f5c\uff0c\u4ece\u800c\u907f\u514d\u4f7f\u7528Python\u7684for\u5faa\u73af\uff0c\u5927\u5e45\u63d0\u9ad8\u8ba1\u7b97\u6548\u7387\u3002\u4f8b\u5982\uff0c\u4f7f\u7528NumPy\u6570\u7ec4\u5bf9\u4e24\u4e2a\u6570\u7ec4\u8fdb\u884c\u9010\u5143\u7d20\u52a0\u6cd5\u64cd\u4f5c\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<h2><strong>\u521b\u5efa\u4e24\u4e2aNumPy\u6570\u7ec4<\/strong><\/h2>\n<p>array1 = np.array([1, 2, 3, 4, 5])<\/p>\n<p>array2 = np.array([6, 7, 8, 9, 10])<\/p>\n<h2><strong>\u9010\u5143\u7d20\u52a0\u6cd5\u64cd\u4f5c<\/strong><\/h2>\n<p>result = array1 + array2<\/p>\n<p>print(result)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6837\uff0cNumPy\u4f1a\u81ea\u52a8\u8fdb\u884c\u9ad8\u6548\u7684\u5411\u91cf\u5316\u64cd\u4f5c\uff0c\u4f7f\u5f97\u8ba1\u7b97\u901f\u5ea6\u8fdc\u5feb\u4e8e\u666e\u901a\u7684Python\u5217\u8868\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><h4>2. Pandas DataFrame<\/h4>\n<\/p>\n<p><p>Pandas\u662f\u53e6\u4e00\u4e2a\u5e7f\u6cdb\u4f7f\u7528\u7684\u6570\u636e\u5904\u7406\u5e93\uff0c\u7279\u522b\u9002\u7528\u4e8e\u6570\u636e\u5206\u6790\u548c\u64cd\u4f5c\u3002Pandas\u7684\u4e3b\u8981\u6570\u636e\u7ed3\u6784\u662fDataFrame\uff0c\u5b83\u662f\u4e00\u4e2a\u4e8c\u7ef4\u7684\u6570\u636e\u8868\u683c\uff0c\u7c7b\u4f3c\u4e8e\u7535\u5b50\u8868\u683c\u6216\u6570\u636e\u5e93\u8868\u3002\u4e0eNumPy\u6570\u7ec4\u7c7b\u4f3c\uff0cPandas DataFrame\u4e5f\u63d0\u4f9b\u4e86\u5927\u91cf\u9ad8\u6548\u7684\u6570\u636e\u64cd\u4f5c\u548c\u5206\u6790\u51fd\u6570\u3002\u901a\u8fc7\u4f7f\u7528Pandas DataFrame\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u8fdb\u884c\u6570\u636e\u7b5b\u9009\u3001\u6e05\u6d17\u3001\u8f6c\u6362\u548c\u805a\u5408\u7b49\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u4f7f\u7528Pandas DataFrame\u8ba1\u7b97\u67d0\u5217\u7684\u5747\u503c\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2aPandas DataFrame<\/strong><\/h2>\n<p>data = {&#39;A&#39;: [1, 2, 3, 4, 5], &#39;B&#39;: [6, 7, 8, 9, 10]}<\/p>\n<p>df = pd.DataFrame(data)<\/p>\n<h2><strong>\u8ba1\u7b97\u5217&#39;A&#39;\u7684\u5747\u503c<\/strong><\/h2>\n<p>mean_A = df[&#39;A&#39;].mean()<\/p>\n<p>print(mean_A)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Pandas DataFrame\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6570\u636e\u64cd\u4f5c\u548c\u5206\u6790\u529f\u80fd\uff0c\u4f7f\u5f97\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u53d8\u5f97\u66f4\u52a0\u65b9\u4fbf\u548c\u9ad8\u6548\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u8fd0\u7528\u5e76\u884c\u548c\u5206\u5e03\u5f0f\u8ba1\u7b97<\/h3>\n<\/p>\n<p><h4>1. \u591a\u7ebf\u7a0b\u548c\u591a\u8fdb\u7a0b<\/h4>\n<\/p>\n<p><p>Python\u63d0\u4f9b\u4e86\u591a\u7ebf\u7a0b\u548c\u591a\u8fdb\u7a0b\u6a21\u5757\uff0c\u53ef\u4ee5\u7528\u6765\u8fdb\u884c\u5e76\u884c\u8ba1\u7b97\uff0c\u4ece\u800c\u63d0\u9ad8\u6570\u636e\u5904\u7406\u7684\u6548\u7387\u3002\u591a\u7ebf\u7a0b\u9002\u7528\u4e8eI\/O\u5bc6\u96c6\u578b\u4efb\u52a1\uff0c\u800c\u591a\u8fdb\u7a0b\u9002\u7528\u4e8eCPU\u5bc6\u96c6\u578b\u4efb\u52a1\u3002\u901a\u8fc7\u4f7f\u7528<code>threading<\/code>\u548c<code>multiprocessing<\/code>\u6a21\u5757\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u5b9e\u73b0\u5e76\u884c\u8ba1\u7b97\u3002\u4f8b\u5982\uff0c\u4f7f\u7528\u591a\u8fdb\u7a0b\u5bf9\u6570\u636e\u8fdb\u884c\u5e76\u884c\u5904\u7406\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import multiprocessing as mp<\/p>\n<p>def process_data(data):<\/p>\n<p>    # \u6570\u636e\u5904\u7406\u903b\u8f91<\/p>\n<p>    return sum(data)<\/p>\n<p>if __name__ == &#39;__m<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n__&#39;:<\/p>\n<p>    data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]<\/p>\n<p>    # \u5c06\u6570\u636e\u5206\u5757<\/p>\n<p>    chunks = [data[i:i + 2] for i in range(0, len(data), 2)]<\/p>\n<p>    # \u521b\u5efa\u8fdb\u7a0b\u6c60<\/p>\n<p>    pool = mp.Pool(processes=4)<\/p>\n<p>    # \u5e76\u884c\u5904\u7406\u6570\u636e<\/p>\n<p>    results = pool.map(process_data, chunks)<\/p>\n<p>    # \u5408\u5e76\u7ed3\u679c<\/p>\n<p>    total = sum(results)<\/p>\n<p>    print(total)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u591a\u8fdb\u7a0b\u5e76\u884c\u5904\u7406\u6570\u636e\uff0c\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8\u6570\u636e\u5904\u7406\u7684\u6548\u7387\u3002<\/p>\n<\/p>\n<p><h4>2. \u5206\u5e03\u5f0f\u8ba1\u7b97\u6846\u67b6<\/h4>\n<\/p>\n<p><p>\u5bf9\u4e8e\u66f4\u5927\u89c4\u6a21\u7684\u6570\u636e\u5904\u7406\u4efb\u52a1\uff0c\u53ef\u4ee5\u4f7f\u7528\u5206\u5e03\u5f0f\u8ba1\u7b97\u6846\u67b6\uff0c\u5982Dask\u548cRay\u3002Dask\u662f\u4e00\u4e2a\u7075\u6d3b\u7684\u5e76\u884c\u8ba1\u7b97\u5e93\uff0c\u53ef\u4ee5\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u96c6\uff0c\u652f\u6301\u5ef6\u8fdf\u8ba1\u7b97\u548c\u52a8\u6001\u4efb\u52a1\u8c03\u5ea6\u3002Ray\u662f\u4e00\u4e2a\u9ad8\u6027\u80fd\u7684\u5206\u5e03\u5f0f\u8ba1\u7b97\u6846\u67b6\uff0c\u4e13\u4e3a<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u548c<a href=\"https:\/\/docs.pingcode.com\/tag\/AI\" target=\"_blank\">\u4eba\u5de5\u667a\u80fd<\/a>\u4efb\u52a1\u800c\u8bbe\u8ba1\u3002\u901a\u8fc7\u4f7f\u7528Dask\u548cRay\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u5b9e\u73b0\u5206\u5e03\u5f0f\u6570\u636e\u5904\u7406\u3002\u4f8b\u5982\uff0c\u4f7f\u7528Dask\u5bf9\u5927\u89c4\u6a21\u6570\u636e\u8fdb\u884c\u5e76\u884c\u8ba1\u7b97\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import dask.array as da<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2aDask\u6570\u7ec4<\/strong><\/h2>\n<p>data = da.from_array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], chunks=(5,))<\/p>\n<h2><strong>\u8ba1\u7b97\u6570\u7ec4\u7684\u5747\u503c<\/strong><\/h2>\n<p>mean = data.mean().compute()<\/p>\n<p>print(mean)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Dask\u4f1a\u81ea\u52a8\u5c06\u6570\u636e\u5206\u5757\uff0c\u5e76\u5728\u591a\u4e2a\u7ebf\u7a0b\u6216\u8fdb\u7a0b\u4e0a\u8fdb\u884c\u5e76\u884c\u8ba1\u7b97\uff0c\u4ece\u800c\u663e\u8457\u63d0\u9ad8\u6570\u636e\u5904\u7406\u7684\u6548\u7387\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f18\u5316\u4ee3\u7801\u6027\u80fd<\/h3>\n<\/p>\n<p><h4>1. \u4f7f\u7528\u5408\u9002\u7684\u7b97\u6cd5\u548c\u6570\u636e\u7ed3\u6784<\/h4>\n<\/p>\n<p><p>\u9009\u62e9\u5408\u9002\u7684\u7b97\u6cd5\u548c\u6570\u636e\u7ed3\u6784\u662f\u4f18\u5316\u4ee3\u7801\u6027\u80fd\u7684\u5173\u952e\u3002\u4e0d\u540c\u7684\u7b97\u6cd5\u548c\u6570\u636e\u7ed3\u6784\u5728\u4e0d\u540c\u7684\u573a\u666f\u4e0b\u5177\u6709\u4e0d\u540c\u7684\u6027\u80fd\u8868\u73b0\u3002\u4f8b\u5982\uff0c\u4f7f\u7528\u54c8\u5e0c\u8868\uff08\u5982Python\u7684\u5b57\u5178\uff09\u53ef\u4ee5\u5728O(1)\u65f6\u95f4\u590d\u6742\u5ea6\u5185\u5b8c\u6210\u67e5\u627e\u64cd\u4f5c\uff0c\u800c\u4f7f\u7528\u5217\u8868\u8fdb\u884c\u67e5\u627e\u5219\u9700\u8981O(n)\u65f6\u95f4\u590d\u6742\u5ea6\u3002\u56e0\u6b64\uff0c\u6839\u636e\u5177\u4f53\u7684\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u7b97\u6cd5\u548c\u6570\u636e\u7ed3\u6784\uff0c\u53ef\u4ee5\u663e\u8457\u63d0\u5347\u4ee3\u7801\u7684\u6267\u884c\u6548\u7387\u3002<\/p>\n<\/p>\n<p><h4>2. \u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u8ba1\u7b97\u5f00\u9500\u548c\u5185\u5b58\u5360\u7528<\/h4>\n<\/p>\n<p><p>\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u8ba1\u7b97\u5f00\u9500\u548c\u5185\u5b58\u5360\u7528\u4e5f\u662f\u4f18\u5316\u4ee3\u7801\u6027\u80fd\u7684\u91cd\u8981\u624b\u6bb5\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u751f\u6210\u5668\u66ff\u4ee3\u5217\u8868\u6765\u8282\u7701\u5185\u5b58\uff0c\u901a\u8fc7\u7f13\u5b58\u4e2d\u95f4\u7ed3\u679c\u6765\u51cf\u5c11\u91cd\u590d\u8ba1\u7b97\uff0c\u901a\u8fc7\u4f7f\u7528\u6279\u5904\u7406\u6765\u51cf\u5c11I\/O\u64cd\u4f5c\u7b49\u3002\u901a\u8fc7\u8fd9\u4e9b\u624b\u6bb5\uff0c\u53ef\u4ee5\u663e\u8457\u63d0\u5347\u7a0b\u5e8f\u7684\u6267\u884c\u901f\u5ea6\u548c\u6548\u7387\u3002<\/p>\n<\/p>\n<p><p>\u603b\u4e4b\uff0cPython\u5904\u7406\u4e0a\u4e07\u6570\u636e\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528\u9ad8\u6548\u7684\u6570\u636e\u7ed3\u6784\u3001\u8fd0\u7528\u5e76\u884c\u548c\u5206\u5e03\u5f0f\u8ba1\u7b97\u3001\u4f18\u5316\u4ee3\u7801\u6027\u80fd\u3002\u901a\u8fc7\u7efc\u5408\u8fd0\u7528\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u53ef\u4ee5\u663e\u8457\u63d0\u5347\u6570\u636e\u5904\u7406\u7684\u901f\u5ea6\u548c\u6548\u7387\uff0c\u4ece\u800c\u66f4\u597d\u5730\u5e94\u5bf9\u5927\u89c4\u6a21\u6570\u636e\u5904\u7406\u4efb\u52a1\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u9ad8\u6548\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u96c6\uff1f<\/strong><br \/>\u5728\u5904\u7406\u4e0a\u4e07\u6761\u6570\u636e\u65f6\uff0c\u9009\u62e9\u5408\u9002\u7684\u6570\u636e\u7ed3\u6784\u548c\u7b97\u6cd5\u975e\u5e38\u5173\u952e\u3002\u53ef\u4ee5\u5229\u7528Pandas\u5e93\u6765\u52a0\u8f7d\u548c\u64cd\u4f5c\u6570\u636e\uff0c\u56e0\u5176\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u6570\u636e\u6846\u67b6\uff0c\u80fd\u8f7b\u677e\u8fdb\u884c\u6570\u636e\u6e05\u6d17\u3001\u7b5b\u9009\u548c\u5206\u6790\u3002\u6b64\u5916\uff0c\u5229\u7528NumPy\u8fdb\u884c\u6570\u503c\u8ba1\u7b97\u548c\u6570\u7ec4\u64cd\u4f5c\uff0c\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8\u5904\u7406\u901f\u5ea6\u3002<\/p>\n<p><strong>\u4f7f\u7528Python\u5904\u7406\u5927\u6570\u636e\u65f6\u6709\u54ea\u4e9b\u5e38\u89c1\u7684\u5e93\u63a8\u8350\uff1f<\/strong><br \/>\u5904\u7406\u5927\u6570\u636e\u7684\u5e38\u7528\u5e93\u5305\u62ecPandas\u3001NumPy\u3001Dask\u548cPySpark\u3002Pandas\u9002\u5408\u4e2d\u5c0f\u89c4\u6a21\u6570\u636e\u7684\u5206\u6790\uff0cNumPy\u5219\u4e3a\u6570\u503c\u8ba1\u7b97\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u652f\u6301\uff0c\u800cDask\u548cPySpark\u5219\u80fd\u5904\u7406\u5206\u5e03\u5f0f\u6570\u636e\uff0c\u975e\u5e38\u9002\u5408\u5927\u89c4\u6a21\u6570\u636e\u96c6\u7684\u5206\u6790\u3002<\/p>\n<p><strong>\u5728\u5904\u7406\u5927\u91cf\u6570\u636e\u65f6\u5982\u4f55\u4f18\u5316\u5185\u5b58\u4f7f\u7528\uff1f<\/strong><br \/>\u4f18\u5316\u5185\u5b58\u4f7f\u7528\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u9009\u62e9\u5408\u9002\u7684\u6570\u636e\u7c7b\u578b\uff0c\u4f8b\u5982\u4f7f\u7528<code>float32<\/code>\u4ee3\u66ff<code>float64<\/code>\uff0c\u4f7f\u7528<code>category<\/code>\u7c7b\u578b\u6765\u5904\u7406\u91cd\u590d\u9879\uff0c\u5206\u5757\u8bfb\u53d6\u6570\u636e\u4ee5\u53ca\u4f7f\u7528\u751f\u6210\u5668\u7b49\u65b9\u5f0f\u6765\u51cf\u5c11\u5185\u5b58\u6d88\u8017\u3002\u6b64\u5916\uff0c\u5b9a\u671f\u6e05\u7406\u4e0d\u518d\u4f7f\u7528\u7684\u53d8\u91cf\u4e5f\u6709\u52a9\u4e8e\u91ca\u653e\u5185\u5b58\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u5904\u7406\u4e0a\u4e07\u6570\u636e\u7684\u65b9\u6cd5\u4e3b\u8981\u5305\u62ec\uff1a\u4f7f\u7528\u9ad8\u6548\u7684\u6570\u636e\u7ed3\u6784\u3001\u8fd0\u7528\u5e76\u884c\u548c\u5206\u5e03\u5f0f\u8ba1\u7b97\u3001\u4f18\u5316\u4ee3\u7801\u6027\u80fd\u3002\u4f7f\u7528\u9ad8\u6548\u7684\u6570\u636e [&hellip;]","protected":false},"author":3,"featured_media":1084906,"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\/1084898"}],"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=1084898"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1084898\/revisions"}],"predecessor-version":[{"id":1084911,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1084898\/revisions\/1084911"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1084906"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1084898"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1084898"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1084898"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}