{"id":1102508,"date":"2025-01-08T16:00:38","date_gmt":"2025-01-08T08:00:38","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1102508.html"},"modified":"2025-01-08T16:00:42","modified_gmt":"2025-01-08T08:00:42","slug":"python%e5%a6%82%e4%bd%95%e7%9c%8b%e4%b8%80%e4%b8%aa%e7%9f%a9%e9%98%b5%e7%9a%84%e5%bd%a2%e7%8a%b6-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1102508.html","title":{"rendered":"python\u5982\u4f55\u770b\u4e00\u4e2a\u77e9\u9635\u7684\u5f62\u72b6"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25064803\/f3ff83b4-f70e-4e1f-88b6-3a35a4a8f60d.webp\" alt=\"python\u5982\u4f55\u770b\u4e00\u4e2a\u77e9\u9635\u7684\u5f62\u72b6\" \/><\/p>\n<p><p> <strong>Python\u4e2d\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u6cd5\u67e5\u770b\u77e9\u9635\u7684\u5f62\u72b6<\/strong>\uff0c\u5305\u62ec\u4f7f\u7528NumPy\u5e93\u3001Pandas\u5e93\u7b49\u3002\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\u5229\u7528NumPy\u5e93\u4e2d\u7684<code>shape<\/code>\u5c5e\u6027\u6765\u67e5\u770b\u77e9\u9635\u7684\u5f62\u72b6\u3002<strong>NumPy\u662fPython\u4e2d\u5904\u7406\u6570\u7ec4\u548c\u77e9\u9635\u7684\u57fa\u7840\u5e93<\/strong>\uff0c\u5b83\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u64cd\u4f5c\u548c\u51fd\u6570\uff0c\u4f7f\u5f97\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u66f4\u52a0\u65b9\u4fbf\u3002\u5728\u4e0b\u9762\u7684\u5185\u5bb9\u4e2d\uff0c\u6211\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528NumPy\u3001Pandas\u7b49\u5e93\u6765\u67e5\u770b\u77e9\u9635\u7684\u5f62\u72b6\uff0c\u5e76\u63d0\u4f9b\u4e00\u4e9b\u5b9e\u7528\u7684\u793a\u4f8b\u548c\u4ee3\u7801\u7247\u6bb5\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528NumPy\u67e5\u770b\u77e9\u9635\u5f62\u72b6<\/h3>\n<\/p>\n<p><p>NumPy\u662fPython\u4e2d\u5904\u7406\u6570\u7ec4\u548c\u77e9\u9635\u7684\u57fa\u7840\u5e93\uff0c\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u64cd\u4f5c\u548c\u51fd\u6570\u3002\u8981\u67e5\u770b\u4e00\u4e2a\u77e9\u9635\u7684\u5f62\u72b6\uff0c\u53ef\u4ee5\u4f7f\u7528NumPy\u7684<code>shape<\/code>\u5c5e\u6027\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5NumPy<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86NumPy\u5e93\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install numpy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u521b\u5efa\u4e00\u4e2a\u77e9\u9635<\/h4>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u521b\u5efa\u4e00\u4e2aNumPy\u77e9\u9635\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a3x4\u7684\u77e9\u9635<\/strong><\/h2>\n<p>matrix = np.array([[1, 2, 3, 4],<\/p>\n<p>                   [5, 6, 7, 8],<\/p>\n<p>                   [9, 10, 11, 12]])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u67e5\u770b\u77e9\u9635\u7684\u5f62\u72b6<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>shape<\/code>\u5c5e\u6027\u6765\u67e5\u770b\u77e9\u9635\u7684\u5f62\u72b6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">shape = matrix.shape<\/p>\n<p>print(&quot;\u77e9\u9635\u7684\u5f62\u72b6\u662f:&quot;, shape)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u5c06\u8f93\u51fa\u77e9\u9635\u7684\u5f62\u72b6 <code>(3, 4)<\/code>\uff0c\u8868\u793a\u8be5\u77e9\u9635\u67093\u884c4\u5217\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528Pandas\u67e5\u770bDataFrame\u5f62\u72b6<\/h3>\n<\/p>\n<p><p>Pandas\u662fPython\u4e2d\u5904\u7406\u6570\u636e\u5206\u6790\u548c\u64cd\u4f5c\u7684\u5f3a\u5927\u5de5\u5177\uff0cDataFrame\u662fPandas\u4e2d\u6700\u5e38\u7528\u7684\u6570\u636e\u7ed3\u6784\u4e4b\u4e00\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Pandas\u6765\u67e5\u770bDataFrame\u7684\u5f62\u72b6\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5Pandas<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86Pandas\u5e93\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install pandas<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u521b\u5efa\u4e00\u4e2aDataFrame<\/h4>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u521b\u5efa\u4e00\u4e2aPandas DataFrame\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2aDataFrame<\/strong><\/h2>\n<p>data = {&#39;A&#39;: [1, 2, 3, 4],<\/p>\n<p>        &#39;B&#39;: [5, 6, 7, 8],<\/p>\n<p>        &#39;C&#39;: [9, 10, 11, 12]}<\/p>\n<p>df = pd.DataFrame(data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u67e5\u770bDataFrame\u7684\u5f62\u72b6<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>shape<\/code>\u5c5e\u6027\u6765\u67e5\u770bDataFrame\u7684\u5f62\u72b6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">shape = df.shape<\/p>\n<p>print(&quot;DataFrame\u7684\u5f62\u72b6\u662f:&quot;, shape)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u5c06\u8f93\u51faDataFrame\u7684\u5f62\u72b6 <code>(4, 3)<\/code>\uff0c\u8868\u793a\u8be5DataFrame\u67094\u884c3\u5217\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528SciPy\u67e5\u770b\u7a00\u758f\u77e9\u9635\u5f62\u72b6<\/h3>\n<\/p>\n<p><p>SciPy\u662fPython\u4e2d\u7528\u4e8e\u79d1\u5b66\u8ba1\u7b97\u7684\u5e93\uff0c\u63d0\u4f9b\u4e86\u5904\u7406\u7a00\u758f\u77e9\u9635\u7684\u529f\u80fd\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528SciPy\u6765\u67e5\u770b\u7a00\u758f\u77e9\u9635\u7684\u5f62\u72b6\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5SciPy<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86SciPy\u5e93\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install scipy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u521b\u5efa\u4e00\u4e2a\u7a00\u758f\u77e9\u9635<\/h4>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u521b\u5efa\u4e00\u4e2aSciPy\u7a00\u758f\u77e9\u9635\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from scipy.sparse import csr_matrix<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a3x4\u7684\u7a00\u758f\u77e9\u9635<\/strong><\/h2>\n<p>matrix = csr_matrix([[1, 0, 0, 4],<\/p>\n<p>                     [0, 6, 0, 0],<\/p>\n<p>                     [9, 0, 0, 12]])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u67e5\u770b\u7a00\u758f\u77e9\u9635\u7684\u5f62\u72b6<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>shape<\/code>\u5c5e\u6027\u6765\u67e5\u770b\u7a00\u758f\u77e9\u9635\u7684\u5f62\u72b6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">shape = matrix.shape<\/p>\n<p>print(&quot;\u7a00\u758f\u77e9\u9635\u7684\u5f62\u72b6\u662f:&quot;, shape)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u5c06\u8f93\u51fa\u7a00\u758f\u77e9\u9635\u7684\u5f62\u72b6 <code>(3, 4)<\/code>\uff0c\u8868\u793a\u8be5\u7a00\u758f\u77e9\u9635\u67093\u884c4\u5217\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528TensorFlow\u67e5\u770b\u5f20\u91cf\u5f62\u72b6<\/h3>\n<\/p>\n<p><p>TensorFlow\u662f\u4e00\u4e2a\u7528\u4e8e<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u548c\u6df1\u5ea6\u5b66\u4e60\u7684\u5f00\u6e90\u6846\u67b6\uff0c\u5b83\u5904\u7406\u7684\u6570\u636e\u7ed3\u6784\u662f\u5f20\u91cf\uff08Tensor\uff09\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528TensorFlow\u6765\u67e5\u770b\u5f20\u91cf\u7684\u5f62\u72b6\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5TensorFlow<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86TensorFlow\u5e93\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install tensorflow<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u521b\u5efa\u4e00\u4e2a\u5f20\u91cf<\/h4>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u521b\u5efa\u4e00\u4e2aTensorFlow\u5f20\u91cf\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import tensorflow as tf<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a3x4\u7684\u5f20\u91cf<\/strong><\/h2>\n<p>tensor = tf.constant([[1, 2, 3, 4],<\/p>\n<p>                      [5, 6, 7, 8],<\/p>\n<p>                      [9, 10, 11, 12]])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u67e5\u770b\u5f20\u91cf\u7684\u5f62\u72b6<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>shape<\/code>\u5c5e\u6027\u6765\u67e5\u770b\u5f20\u91cf\u7684\u5f62\u72b6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">shape = tensor.shape<\/p>\n<p>print(&quot;\u5f20\u91cf\u7684\u5f62\u72b6\u662f:&quot;, shape)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u5c06\u8f93\u51fa\u5f20\u91cf\u7684\u5f62\u72b6 <code>(3, 4)<\/code>\uff0c\u8868\u793a\u8be5\u5f20\u91cf\u67093\u884c4\u5217\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u4f7f\u7528PyTorch\u67e5\u770b\u5f20\u91cf\u5f62\u72b6<\/h3>\n<\/p>\n<p><p>PyTorch\u662f\u53e6\u4e00\u4e2a\u7528\u4e8e\u673a\u5668\u5b66\u4e60\u548c\u6df1\u5ea6\u5b66\u4e60\u7684\u5f00\u6e90\u6846\u67b6\uff0c\u5b83\u5904\u7406\u7684\u6570\u636e\u7ed3\u6784\u4e5f\u662f\u5f20\u91cf\uff08Tensor\uff09\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528PyTorch\u6765\u67e5\u770b\u5f20\u91cf\u7684\u5f62\u72b6\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5PyTorch<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86PyTorch\u5e93\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install torch<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u521b\u5efa\u4e00\u4e2a\u5f20\u91cf<\/h4>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u521b\u5efa\u4e00\u4e2aPyTorch\u5f20\u91cf\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import torch<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a3x4\u7684\u5f20\u91cf<\/strong><\/h2>\n<p>tensor = torch.tensor([[1, 2, 3, 4],<\/p>\n<p>                       [5, 6, 7, 8],<\/p>\n<p>                       [9, 10, 11, 12]])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u67e5\u770b\u5f20\u91cf\u7684\u5f62\u72b6<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>shape<\/code>\u5c5e\u6027\u6765\u67e5\u770b\u5f20\u91cf\u7684\u5f62\u72b6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">shape = tensor.shape<\/p>\n<p>print(&quot;\u5f20\u91cf\u7684\u5f62\u72b6\u662f:&quot;, shape)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u5c06\u8f93\u51fa\u5f20\u91cf\u7684\u5f62\u72b6 <code>(3, 4)<\/code>\uff0c\u8868\u793a\u8be5\u5f20\u91cf\u67093\u884c4\u5217\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u5728Python\u4e2d\u67e5\u770b\u77e9\u9635\u7684\u5f62\u72b6\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\uff0c\u6700\u5e38\u89c1\u7684\u662f\u5229\u7528NumPy\u5e93\u7684<code>shape<\/code>\u5c5e\u6027\u3002\u6b64\u5916\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528Pandas\u6765\u67e5\u770bDataFrame\u7684\u5f62\u72b6\uff0c\u4f7f\u7528SciPy\u6765\u67e5\u770b\u7a00\u758f\u77e9\u9635\u7684\u5f62\u72b6\uff0c\u4f7f\u7528TensorFlow\u548cPyTorch\u6765\u67e5\u770b\u5f20\u91cf\u7684\u5f62\u72b6\u3002<strong>\u8fd9\u4e9b\u65b9\u6cd5\u90fd\u975e\u5e38\u7b80\u6d01\u4e14\u6613\u4e8e\u4f7f\u7528<\/strong>\uff0c\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5feb\u901f\u4e86\u89e3\u6570\u636e\u7684\u7ed3\u6784\u548c\u7ef4\u5ea6\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u65b9\u6cd5\u548c\u793a\u4f8b\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u67e5\u770bPython\u4e2d\u4e0d\u540c\u7c7b\u578b\u77e9\u9635\u7684\u5f62\u72b6\uff0c\u4ece\u800c\u66f4\u597d\u5730\u7406\u89e3\u548c\u5904\u7406\u6570\u636e\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u5e93\u548c\u65b9\u6cd5\uff0c\u53ef\u4ee5\u63d0\u9ad8\u6570\u636e\u5904\u7406\u7684\u6548\u7387\u548c\u51c6\u786e\u6027\u3002\u5e0c\u671b\u8fd9\u4e9b\u5185\u5bb9\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff0c\u5e76\u80fd\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u7075\u6d3b\u5e94\u7528\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u83b7\u53d6\u77e9\u9635\u7684\u5f62\u72b6\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u4f7f\u7528NumPy\u5e93\u53ef\u4ee5\u975e\u5e38\u65b9\u4fbf\u5730\u83b7\u53d6\u77e9\u9635\u7684\u5f62\u72b6\u3002\u53ea\u9700\u8c03\u7528\u77e9\u9635\u5bf9\u8c61\u7684<code>shape<\/code>\u5c5e\u6027\u5373\u53ef\u3002\u4f8b\u5982\uff0c\u5047\u8bbe\u4f60\u6709\u4e00\u4e2aNumPy\u6570\u7ec4<code>matrix<\/code>\uff0c\u53ef\u4ee5\u901a\u8fc7<code>matrix.shape<\/code>\u83b7\u53d6\u5b83\u7684\u884c\u6570\u548c\u5217\u6570\uff0c\u8fd4\u56de\u7684\u7ed3\u679c\u662f\u4e00\u4e2a\u5143\u7ec4\uff0c\u5f62\u5f0f\u4e3a<code>(\u884c\u6570, \u5217\u6570)<\/code>\u3002<\/p>\n<p><strong>\u662f\u5426\u53ef\u4ee5\u4f7f\u7528\u5176\u4ed6\u5e93\u6765\u67e5\u770b\u77e9\u9635\u7684\u5f62\u72b6\uff1f<\/strong><br \/>\u9664\u4e86NumPy\uff0cPandas\u5e93\u4e5f\u53ef\u4ee5\u7528\u4e8e\u67e5\u770b\u6570\u636e\u6846\u7684\u5f62\u72b6\u3002\u4f7f\u7528<code>DataFrame<\/code>\u5bf9\u8c61\u65f6\uff0c\u53ef\u4ee5\u8c03\u7528<code>df.shape<\/code>\u5c5e\u6027\u6765\u83b7\u53d6\u884c\u6570\u548c\u5217\u6570\u3002Pandas\u7279\u522b\u9002\u5408\u5904\u7406\u8868\u683c\u6570\u636e\uff0c\u56e0\u6b64\u5982\u679c\u4f60\u7684\u77e9\u9635\u662f\u4ee5\u6570\u636e\u6846\u7684\u5f62\u5f0f\u5b58\u5728\uff0c\u8fd9\u5c06\u662f\u4e00\u4e2a\u6709\u6548\u7684\u65b9\u6cd5\u3002<\/p>\n<p><strong>\u83b7\u53d6\u77e9\u9635\u5f62\u72b6\u65f6\uff0c\u6709\u54ea\u4e9b\u5e38\u89c1\u7684\u9519\u8bef\u9700\u8981\u907f\u514d\uff1f<\/strong><br \/>\u5728\u4f7f\u7528NumPy\u83b7\u53d6\u77e9\u9635\u5f62\u72b6\u65f6\uff0c\u786e\u4fdd\u8f93\u5165\u7684\u662fNumPy\u6570\u7ec4\u800c\u4e0d\u662f\u5217\u8868\u6216\u5176\u4ed6\u6570\u636e\u7c7b\u578b\u3002\u82e5\u8f93\u5165\u7684\u662fPython\u5217\u8868\uff0c\u8c03\u7528<code>shape<\/code>\u5c5e\u6027\u5c06\u4e0d\u4f1a\u8fd4\u56de\u9884\u671f\u7684\u7ed3\u679c\u3002\u4e3a\u4e86\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\uff0c\u5148\u4f7f\u7528<code>np.array()<\/code>\u5c06\u5217\u8868\u8f6c\u6362\u4e3aNumPy\u6570\u7ec4\uff0c\u518d\u83b7\u53d6\u5176\u5f62\u72b6\u3002<\/p>\n<p><strong>\u53ef\u4ee5\u901a\u8fc7\u53ef\u89c6\u5316\u5de5\u5177\u67e5\u770b\u77e9\u9635\u7684\u5f62\u72b6\u5417\uff1f<\/strong><br \/>\u662f\u7684\uff0c\u53ef\u4ee5\u4f7f\u7528\u53ef\u89c6\u5316\u5de5\u5177\u5982Matplotlib\u6216Seaborn\u6765\u5c55\u793a\u77e9\u9635\u7684\u5f62\u72b6\u53ca\u5176\u6570\u636e\u5206\u5e03\u3002\u901a\u8fc7\u7ed8\u5236\u70ed\u56fe\u6216\u6563\u70b9\u56fe\uff0c\u53ef\u4ee5\u76f4\u89c2\u5730\u7406\u89e3\u77e9\u9635\u7684\u6570\u636e\u7ed3\u6784\u548c\u5f62\u72b6\u3002\u8fd9\u79cd\u53ef\u89c6\u5316\u65b9\u6cd5\u5bf9\u4e8e\u5206\u6790\u548c\u89e3\u91ca\u6570\u636e\u975e\u5e38\u6709\u5e2e\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u4e2d\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u6cd5\u67e5\u770b\u77e9\u9635\u7684\u5f62\u72b6\uff0c\u5305\u62ec\u4f7f\u7528NumPy\u5e93\u3001Pandas\u5e93\u7b49\u3002\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\u5229\u7528Num [&hellip;]","protected":false},"author":3,"featured_media":1102516,"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\/1102508"}],"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=1102508"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1102508\/revisions"}],"predecessor-version":[{"id":1102520,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1102508\/revisions\/1102520"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1102516"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1102508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1102508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1102508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}