{"id":1001793,"date":"2024-12-27T10:03:21","date_gmt":"2024-12-27T02:03:21","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1001793.html"},"modified":"2024-12-27T10:03:24","modified_gmt":"2024-12-27T02:03:24","slug":"%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8python%e8%ae%a1%e7%ae%97%e7%9f%a9%e9%98%b5","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1001793.html","title":{"rendered":"\u5982\u4f55\u5229\u7528python\u8ba1\u7b97\u77e9\u9635"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25075821\/6dd877b0-b960-4c54-bfb6-40fac2ca4011.webp\" alt=\"\u5982\u4f55\u5229\u7528python\u8ba1\u7b97\u77e9\u9635\" \/><\/p>\n<p><p> <strong>\u5229\u7528Python\u8ba1\u7b97\u77e9\u9635\u7684\u65b9\u6cd5\u4e3b\u8981\u5305\u62ec\uff1a\u4f7f\u7528NumPy\u5e93\u8fdb\u884c\u77e9\u9635\u7684\u521b\u5efa\u4e0e\u57fa\u672c\u8fd0\u7b97\u3001\u5229\u7528SciPy\u5e93\u8fdb\u884c\u9ad8\u7ea7\u77e9\u9635\u8fd0\u7b97\u3001\u4f7f\u7528SymPy\u5e93\u8fdb\u884c\u7b26\u53f7\u77e9\u9635\u8fd0\u7b97\u3001\u901a\u8fc7Pandas\u5e93\u8fdb\u884c\u6570\u636e\u5206\u6790\u4e0e\u5904\u7406\u3002<\/strong>\u5176\u4e2d\uff0cNumPy\u5e93\u662f\u8fdb\u884c\u77e9\u9635\u8ba1\u7b97\u7684\u9996\u9009\u5de5\u5177\uff0c\u5b83\u652f\u6301\u77e9\u9635\u7684\u52a0\u51cf\u4e58\u9664\u3001\u8f6c\u7f6e\u3001\u9006\u77e9\u9635\u7b49\u57fa\u672c\u64cd\u4f5c\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5229\u7528Python\u8fdb\u884c\u77e9\u9635\u8ba1\u7b97\uff0c\u5e76\u63a2\u8ba8\u5176\u4ed6\u76f8\u5173\u7684\u9ad8\u7ea7\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001NUMPY\u5e93\u4e0e\u77e9\u9635\u8ba1\u7b97<\/p>\n<\/p>\n<p><p>NumPy\u662fPython\u4e2d\u6700\u5e38\u7528\u7684\u79d1\u5b66\u8ba1\u7b97\u5e93\u4e4b\u4e00\uff0c\u5b83\u63d0\u4f9b\u4e86\u652f\u6301\u5927\u591a\u6570\u5b66\u79d1\u7684\u591a\u7ef4\u6570\u7ec4\u5bf9\u8c61\u548c\u76f8\u5173\u64cd\u4f5c\u5de5\u5177\u3002\u5229\u7528NumPy\u8fdb\u884c\u77e9\u9635\u8ba1\u7b97\u662f\u8ba1\u7b97\u673a\u79d1\u5b66\u3001\u5de5\u7a0b\u548c\u6570\u636e\u5206\u6790\u9886\u57df\u7684\u57fa\u7840\u3002<\/p>\n<\/p>\n<ol>\n<li>\u521b\u5efa\u77e9\u9635<\/li>\n<\/ol>\n<p><p>\u5728NumPy\u4e2d\uff0c\u77e9\u9635\u53ef\u4ee5\u901a\u8fc7\u6570\u7ec4\u521b\u5efa\u3002\u4f7f\u7528<code>numpy.array()<\/code>\u51fd\u6570\u53ef\u4ee5\u521b\u5efa\u4efb\u610f\u7ef4\u5ea6\u7684\u6570\u7ec4\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u521b\u5efa\u77e9\u9635\u7684\u4f8b\u5b50\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a2x3\u77e9\u9635<\/strong><\/h2>\n<p>matrix = np.array([[1, 2, 3], [4, 5, 6]])<\/p>\n<p>print(matrix)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u57fa\u672c\u77e9\u9635\u8fd0\u7b97<\/li>\n<\/ol>\n<p><p>NumPy\u652f\u6301\u77e9\u9635\u7684\u57fa\u672c\u8fd0\u7b97\uff0c\u5305\u62ec\u52a0\u51cf\u4e58\u9664\u3001\u77e9\u9635\u4e58\u6cd5\u3001\u8f6c\u7f6e\u7b49\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u64cd\u4f5c\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u77e9\u9635\u52a0\u6cd5\u4e0e\u51cf\u6cd5<\/strong>\uff1a\u76f4\u63a5\u4f7f\u7528<code>+<\/code>\u548c<code>-<\/code>\u8fd0\u7b97\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">matrix1 = np.array([[1, 2], [3, 4]])<\/p>\n<p>matrix2 = np.array([[5, 6], [7, 8]])<\/p>\n<h2><strong>\u77e9\u9635\u52a0\u6cd5<\/strong><\/h2>\n<p>result_add = matrix1 + matrix2<\/p>\n<h2><strong>\u77e9\u9635\u51cf\u6cd5<\/strong><\/h2>\n<p>result_subtract = matrix1 - matrix2<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u77e9\u9635\u4e58\u6cd5<\/strong>\uff1a\u4f7f\u7528<code>@<\/code>\u8fd0\u7b97\u7b26\u6216<code>numpy.dot()<\/code>\u51fd\u6570\u8fdb\u884c\u77e9\u9635\u4e58\u6cd5\u8fd0\u7b97\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u77e9\u9635\u4e58\u6cd5<\/p>\n<p>result_multiply = matrix1 @ matrix2<\/p>\n<h2><strong>\u6216\u8005<\/strong><\/h2>\n<p>result_multiply = np.dot(matrix1, matrix2)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u77e9\u9635\u8f6c\u7f6e<\/strong>\uff1a\u4f7f\u7528<code>numpy.transpose()<\/code>\u51fd\u6570\u6216<code>T<\/code>\u5c5e\u6027\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u77e9\u9635\u8f6c\u7f6e<\/p>\n<p>transposed_matrix = matrix1.T<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9006\u77e9\u9635<\/strong>\uff1a\u4f7f\u7528<code>numpy.linalg.inv()<\/code>\u51fd\u6570\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u8ba1\u7b97\u9006\u77e9\u9635<\/p>\n<p>inverse_matrix = np.linalg.inv(matrix1)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<ol start=\"3\">\n<li>\u77e9\u9635\u7684\u7279\u6b8a\u8fd0\u7b97<\/li>\n<\/ol>\n<p><p>\u9664\u4e86\u57fa\u672c\u8fd0\u7b97\uff0cNumPy\u8fd8\u652f\u6301\u4e00\u4e9b\u7279\u6b8a\u7684\u77e9\u9635\u8fd0\u7b97\uff0c\u6bd4\u5982\u884c\u5217\u5f0f\u3001\u7279\u5f81\u503c\u548c\u7279\u5f81\u5411\u91cf\u7b49\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u884c\u5217\u5f0f<\/strong>\uff1a\u4f7f\u7528<code>numpy.linalg.det()<\/code>\u51fd\u6570\u8ba1\u7b97\u77e9\u9635\u7684\u884c\u5217\u5f0f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u8ba1\u7b97\u884c\u5217\u5f0f<\/p>\n<p>determinant = np.linalg.det(matrix1)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7279\u5f81\u503c\u548c\u7279\u5f81\u5411\u91cf<\/strong>\uff1a\u4f7f\u7528<code>numpy.linalg.eig()<\/code>\u51fd\u6570\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u8ba1\u7b97\u7279\u5f81\u503c\u548c\u7279\u5f81\u5411\u91cf<\/p>\n<p>eigenvalues, eigenvectors = np.linalg.eig(matrix1)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<p><p>\u4e8c\u3001SCIPY\u5e93\u4e0e\u9ad8\u7ea7\u77e9\u9635\u8fd0\u7b97<\/p>\n<\/p>\n<p><p>SciPy\u662f\u4e00\u4e2a\u57fa\u4e8eNumPy\u7684\u5f00\u6e90Python\u5e93\uff0c\u63d0\u4f9b\u4e86\u8bb8\u591a\u7528\u4e8e\u79d1\u5b66\u548c\u5de5\u7a0b\u8ba1\u7b97\u7684\u9ad8\u7ea7\u7b97\u6cd5\u3002\u5b83\u5728\u77e9\u9635\u8fd0\u7b97\u4e2d\u63d0\u4f9b\u4e86\u66f4\u591a\u9ad8\u7ea7\u529f\u80fd\uff0c\u5982\u7a00\u758f\u77e9\u9635\u8fd0\u7b97\u3001\u77e9\u9635\u5206\u89e3\u7b49\u3002<\/p>\n<\/p>\n<ol>\n<li>\u7a00\u758f\u77e9\u9635\u8fd0\u7b97<\/li>\n<\/ol>\n<p><p>\u5bf9\u4e8e\u5927\u89c4\u6a21\u77e9\u9635\u8fd0\u7b97\uff0c\u7a00\u758f\u77e9\u9635\u53ef\u4ee5\u6709\u6548\u51cf\u5c11\u5185\u5b58\u548c\u8ba1\u7b97\u65f6\u95f4\u3002\u5728SciPy\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>scipy.sparse<\/code>\u6a21\u5757\u5904\u7406\u7a00\u758f\u77e9\u9635\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from scipy.sparse import csr_matrix<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u7a00\u758f\u77e9\u9635<\/strong><\/h2>\n<p>sparse_matrix = csr_matrix([[1, 0, 0], [0, 0, 2], [0, 3, 0]])<\/p>\n<p>print(sparse_matrix)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u77e9\u9635\u5206\u89e3<\/li>\n<\/ol>\n<p><p>SciPy\u652f\u6301\u591a\u79cd\u77e9\u9635\u5206\u89e3\u65b9\u6cd5\uff0c\u5982LU\u5206\u89e3\u3001QR\u5206\u89e3\u3001SVD\u5206\u89e3\u7b49\u3002\u8fd9\u4e9b\u5206\u89e3\u65b9\u6cd5\u5728\u6570\u503c\u8ba1\u7b97\u548c\u4fe1\u53f7\u5904\u7406\u4e2d\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>LU\u5206\u89e3<\/strong>\uff1a\u4f7f\u7528<code>scipy.linalg.lu()<\/code>\u51fd\u6570\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from scipy.linalg import lu<\/p>\n<p>P, L, U = lu(matrix1)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>QR\u5206\u89e3<\/strong>\uff1a\u4f7f\u7528<code>scipy.linalg.qr()<\/code>\u51fd\u6570\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from scipy.linalg import qr<\/p>\n<p>Q, R = qr(matrix1)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>SVD\u5206\u89e3<\/strong>\uff1a\u4f7f\u7528<code>scipy.linalg.svd()<\/code>\u51fd\u6570\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from scipy.linalg import svd<\/p>\n<p>U, S, Vh = svd(matrix1)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<p><p>\u4e09\u3001SYMPY\u5e93\u4e0e\u7b26\u53f7\u77e9\u9635\u8fd0\u7b97<\/p>\n<\/p>\n<p><p>SymPy\u662f\u4e00\u4e2a\u7528\u4e8e\u7b26\u53f7\u6570\u5b66\u8ba1\u7b97\u7684Python\u5e93\uff0c\u5b83\u5141\u8bb8\u8fdb\u884c\u7b26\u53f7\u77e9\u9635\u8fd0\u7b97\u3002\u5bf9\u4e8e\u9700\u8981\u7cbe\u786e\u8ba1\u7b97\u7684\u6570\u5b66\u95ee\u9898\uff0cSymPy\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u5de5\u5177\u3002<\/p>\n<\/p>\n<ol>\n<li>\u7b26\u53f7\u77e9\u9635\u521b\u5efa<\/li>\n<\/ol>\n<p><p>\u5728SymPy\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>Matrix<\/code>\u7c7b\u521b\u5efa\u7b26\u53f7\u77e9\u9635\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sympy import Matrix, symbols<\/p>\n<h2><strong>\u521b\u5efa\u7b26\u53f7\u53d8\u91cf<\/strong><\/h2>\n<p>x, y, z = symbols(&#39;x y z&#39;)<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u7b26\u53f7\u77e9\u9635<\/strong><\/h2>\n<p>symbolic_matrix = Matrix([[x, y], [z, 1]])<\/p>\n<p>print(symbolic_matrix)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u7b26\u53f7\u77e9\u9635\u8fd0\u7b97<\/li>\n<\/ol>\n<p><p>SymPy\u652f\u6301\u5404\u79cd\u7b26\u53f7\u8fd0\u7b97\uff0c\u5305\u62ec\u7b26\u53f7\u6c42\u5bfc\u3001\u79ef\u5206\u3001\u89e3\u65b9\u7a0b\u7b49\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u77e9\u9635\u6c42\u5bfc<\/strong>\uff1a\u53ef\u4ee5\u5bf9\u77e9\u9635\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\u8fdb\u884c\u6c42\u5bfc\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u77e9\u9635\u6c42\u5bfc<\/p>\n<p>derivative_matrix = symbolic_matrix.diff(x)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u89e3\u65b9\u7a0b<\/strong>\uff1a\u53ef\u4ee5\u4f7f\u7528<code>solve<\/code>\u51fd\u6570\u89e3\u7b26\u53f7\u77e9\u9635\u65b9\u7a0b\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sympy import solve<\/p>\n<h2><strong>\u89e3\u65b9\u7a0b<\/strong><\/h2>\n<p>solutions = solve(symbolic_matrix, (x, y, z))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<p><p>\u56db\u3001PANDAS\u5e93\u4e0e\u6570\u636e\u5206\u6790\u4e2d\u7684\u77e9\u9635\u8fd0\u7b97<\/p>\n<\/p>\n<p><p>\u867d\u7136Pandas\u4e3b\u8981\u7528\u4e8e\u6570\u636e\u5206\u6790\uff0c\u4f46\u5b83\u4e5f\u53ef\u4ee5\u5904\u7406\u7c7b\u4f3c\u77e9\u9635\u7684\u6570\u636e\u7ed3\u6784\u3002\u901a\u8fc7Pandas\uff0c\u6570\u636e\u5206\u6790\u5e08\u53ef\u4ee5\u8f7b\u677e\u64cd\u4f5c\u548c\u5206\u6790\u6570\u636e\u3002<\/p>\n<\/p>\n<ol>\n<li>DataFrame\u4e0e\u77e9\u9635<\/li>\n<\/ol>\n<p><p>\u5728Pandas\u4e2d\uff0c<code>DataFrame<\/code>\u7c7b\u4f3c\u4e8e\u77e9\u9635\uff0c\u5141\u8bb8\u884c\u5217\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<h2><strong>\u521b\u5efaDataFrame<\/strong><\/h2>\n<p>data = {&#39;A&#39;: [1, 2, 3], &#39;B&#39;: [4, 5, 6]}<\/p>\n<p>df = pd.DataFrame(data)<\/p>\n<p>print(df)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u6570\u636e\u5206\u6790\u4e0e\u8fd0\u7b97<\/li>\n<\/ol>\n<p><p>Pandas\u63d0\u4f9b\u4e86\u4e00\u4e9b\u7528\u4e8e\u6570\u636e\u5206\u6790\u7684\u5185\u7f6e\u51fd\u6570\uff0c\u5982\u6c42\u548c\u3001\u5747\u503c\u3001\u6807\u51c6\u5dee\u7b49\u3002\u8fd9\u4e9b\u64cd\u4f5c\u53ef\u4ee5\u5728DataFrame\u4e0a\u8fdb\u884c\uff0c\u7c7b\u4f3c\u4e8e\u77e9\u9635\u8fd0\u7b97\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u6c42\u548c\u4e0e\u5747\u503c<\/strong>\uff1a\u4f7f\u7528<code>sum()<\/code>\u548c<code>mean()<\/code>\u51fd\u6570\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u6c42\u548c<\/p>\n<p>column_sum = df.sum()<\/p>\n<h2><strong>\u6c42\u5747\u503c<\/strong><\/h2>\n<p>column_mean = df.mean()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u636e\u7b5b\u9009\u4e0e\u53d8\u6362<\/strong>\uff1a\u53ef\u4ee5\u901a\u8fc7\u6761\u4ef6\u9009\u62e9\u548c\u51fd\u6570\u5e94\u7528\u5bf9\u6570\u636e\u8fdb\u884c\u7b5b\u9009\u548c\u53d8\u6362\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u6761\u4ef6\u7b5b\u9009<\/p>\n<p>filtered_df = df[df[&#39;A&#39;] &gt; 1]<\/p>\n<h2><strong>\u6570\u636e\u53d8\u6362<\/strong><\/h2>\n<p>transformed_df = df.apply(lambda x: x * 2)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<p><p>\u4e94\u3001\u603b\u7ed3\u4e0e\u5e94\u7528<\/p>\n<\/p>\n<p><p>Python\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u5de5\u5177\u5e93\u6765\u8fdb\u884c\u77e9\u9635\u8ba1\u7b97\uff0c\u6bcf\u4e2a\u5e93\u90fd\u6709\u5176\u72ec\u7279\u7684\u4f18\u52bf\u548c\u9002\u7528\u573a\u666f\u3002NumPy\u9002\u5408\u57fa\u7840\u77e9\u9635\u8fd0\u7b97\uff0c\u662f\u5927\u591a\u6570\u79d1\u5b66\u8ba1\u7b97\u7684\u57fa\u7840\uff1bSciPy\u63d0\u4f9b\u4e86\u9ad8\u7ea7\u7b97\u6cd5\u548c\u7a00\u758f\u77e9\u9635\u5904\u7406\uff1bSymPy\u9002\u5408\u7b26\u53f7\u8fd0\u7b97\u548c\u7cbe\u786e\u8ba1\u7b97\uff1bPandas\u5219\u662f\u6570\u636e\u5206\u6790\u7684\u5229\u5668\u3002\u901a\u8fc7\u5408\u7406\u9009\u62e9\u548c\u7ec4\u5408\u8fd9\u4e9b\u5e93\uff0c\u80fd\u591f\u6709\u6548\u5730\u89e3\u51b3\u5404\u79cd\u77e9\u9635\u8ba1\u7b97\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u7406\u89e3\u95ee\u9898\u7684\u6027\u8d28\u548c\u590d\u6742\u5ea6\uff0c\u5e76\u9009\u62e9\u5408\u9002\u7684\u5de5\u5177\u975e\u5e38\u91cd\u8981\u3002\u65e0\u8bba\u662f\u79d1\u5b66\u7814\u7a76\u3001\u5de5\u7a0b\u8ba1\u7b97\uff0c\u8fd8\u662f\u6570\u636e\u5206\u6790\uff0cPython\u7684\u77e9\u9635\u8ba1\u7b97\u80fd\u529b\u90fd\u80fd\u63d0\u4f9b\u5f3a\u5927\u7684\u652f\u6301\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u7528Python\u5904\u7406\u5927\u89c4\u6a21\u77e9\u9635\u8fd0\u7b97\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u5904\u7406\u5927\u89c4\u6a21\u77e9\u9635\u8fd0\u7b97\u901a\u5e38\u4f7f\u7528NumPy\u5e93\u3002NumPy\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u591a\u7ef4\u6570\u7ec4\u5bf9\u8c61\u548c\u7528\u4e8e\u6570\u7ec4\u8fd0\u7b97\u7684\u51fd\u6570\uff0c\u4f7f\u5f97\u5904\u7406\u5927\u578b\u77e9\u9635\u53d8\u5f97\u7b80\u5355\u3002\u6b64\u5916\uff0c\u5229\u7528NumPy\u7684\u5e7f\u64ad\u529f\u80fd\uff0c\u53ef\u4ee5\u5bf9\u4e0d\u540c\u5f62\u72b6\u7684\u6570\u7ec4\u6267\u884c\u8fd0\u7b97\uff0c\u6781\u5927\u5730\u63d0\u9ad8\u4e86\u8ba1\u7b97\u6548\u7387\u3002<\/p>\n<p><strong>\u4f7f\u7528Python\u8ba1\u7b97\u77e9\u9635\u7684\u5e38\u89c1\u5e94\u7528\u6709\u54ea\u4e9b\uff1f<\/strong><br \/>Python\u8ba1\u7b97\u77e9\u9635\u7684\u5e38\u89c1\u5e94\u7528\u5305\u62ec\u7ebf\u6027\u4ee3\u6570\u3001\u6570\u636e\u5206\u6790\u3001<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u548c\u79d1\u5b66\u8ba1\u7b97\u3002\u5728\u8fd9\u4e9b\u9886\u57df\uff0c\u77e9\u9635\u8fd0\u7b97\u5e38\u7528\u4e8e\u89e3\u51b3\u65b9\u7a0b\u7ec4\u3001\u7279\u5f81\u503c\u5206\u89e3\u3001\u6570\u636e\u964d\u7ef4\u3001\u56fe\u50cf\u5904\u7406\u548c\u795e\u7ecf\u7f51\u7edc\u7684\u8ba1\u7b97\u7b49\u3002<\/p>\n<p><strong>\u5982\u4f55\u63d0\u9ad8Python\u77e9\u9635\u8fd0\u7b97\u7684\u6027\u80fd\uff1f<\/strong><br \/>\u4e3a\u4e86\u63d0\u9ad8Python\u77e9\u9635\u8fd0\u7b97\u7684\u6027\u80fd\uff0c\u53ef\u4ee5\u91c7\u7528\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a\u9996\u5148\uff0c\u4f7f\u7528NumPy\u6216SciPy\u7b49\u9ad8\u6548\u7684\u5e93\uff0c\u907f\u514d\u4f7f\u7528Python\u5185\u7f6e\u5217\u8868\u8fdb\u884c\u77e9\u9635\u8fd0\u7b97\u3002\u5176\u6b21\uff0c\u5229\u7528\u5e76\u884c\u8ba1\u7b97\u5e93\uff0c\u5982Dask\u6216Joblib\uff0c\u5c06\u8ba1\u7b97\u4efb\u52a1\u5206\u53d1\u5230\u591a\u4e2a\u5904\u7406\u5668\u4e0a\u3002\u6700\u540e\uff0c\u8003\u8651\u4f7f\u7528GPU\u52a0\u901f\u5e93\uff0c\u5982CuPy\uff0c\u6765\u5904\u7406\u6781\u5927\u7684\u77e9\u9635\u8fd0\u7b97\uff0c\u63d0\u9ad8\u8ba1\u7b97\u901f\u5ea6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5229\u7528Python\u8ba1\u7b97\u77e9\u9635\u7684\u65b9\u6cd5\u4e3b\u8981\u5305\u62ec\uff1a\u4f7f\u7528NumPy\u5e93\u8fdb\u884c\u77e9\u9635\u7684\u521b\u5efa\u4e0e\u57fa\u672c\u8fd0\u7b97\u3001\u5229\u7528SciPy\u5e93\u8fdb\u884c\u9ad8\u7ea7\u77e9\u9635 [&hellip;]","protected":false},"author":3,"featured_media":1001802,"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\/1001793"}],"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=1001793"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1001793\/revisions"}],"predecessor-version":[{"id":1001805,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1001793\/revisions\/1001805"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1001802"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1001793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1001793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1001793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}