{"id":938352,"date":"2024-12-26T20:09:50","date_gmt":"2024-12-26T12:09:50","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/938352.html"},"modified":"2024-12-26T20:09:53","modified_gmt":"2024-12-26T12:09:53","slug":"python-%e5%a6%82%e4%bd%95%e5%af%bc%e5%85%a5%e6%95%b0%e7%bb%84","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/938352.html","title":{"rendered":"python \u5982\u4f55\u5bfc\u5165\u6570\u7ec4"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25073839\/2bafbb1a-4c82-4420-a067-af7626383e86.webp\" alt=\"python \u5982\u4f55\u5bfc\u5165\u6570\u7ec4\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\u5bfc\u5165\u6570\u7ec4\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\uff0c\u4f8b\u5982\u4f7f\u7528\u5185\u7f6e\u7684\u5217\u8868\u3001NumPy\u5e93\u548cPandas\u5e93\u7b49\uff0c\u8fd9\u4e9b\u65b9\u6cd5\u5404\u6709\u4f18\u7f3a\u70b9\uff1a\u4f7f\u7528\u5185\u7f6e\u5217\u8868\u7075\u6d3b\u6027\u9ad8\u3001\u4f7f\u7528NumPy\u63d0\u4f9b\u9ad8\u6548\u7684\u6570\u7ec4\u64cd\u4f5c\u3001\u4f7f\u7528Pandas\u4fbf\u4e8e\u6570\u636e\u5206\u6790\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u63cf\u8ff0\u5982\u4f55\u4f7f\u7528NumPy\u5bfc\u5165\u6570\u7ec4\u3002<\/strong><\/p>\n<\/p>\n<p><p>NumPy\u662fPython\u4e2d\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u5e93\uff0c\u4e13\u95e8\u7528\u4e8e\u79d1\u5b66\u8ba1\u7b97\u548c\u6570\u636e\u5206\u6790\u3002\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2an\u7ef4\u6570\u7ec4\u5bf9\u8c61\uff0c\u4ee5\u53ca\u8bb8\u591a\u7528\u4e8e\u5feb\u901f\u64cd\u4f5c\u6570\u7ec4\u7684\u51fd\u6570\u3002\u4f7f\u7528NumPy\u53ef\u4ee5\u6781\u5927\u5730\u63d0\u9ad8\u6570\u636e\u5904\u7406\u7684\u6548\u7387\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001NUMPY\u5e93\u7684\u5b89\u88c5\u4e0e\u5bfc\u5165<\/p>\n<\/p>\n<p><p>\u5728\u4f7f\u7528NumPy\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u5b83\u5df2\u7ecf\u5b89\u88c5\u5728\u60a8\u7684Python\u73af\u5883\u4e2d\u3002\u5982\u679c\u5c1a\u672a\u5b89\u88c5\uff0c\u53ef\u4ee5\u901a\u8fc7pip\u547d\u4ee4\u6765\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><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u5728Python\u811a\u672c\u4e2d\u5bfc\u5165NumPy\u5e93\u3002\u901a\u5e38\uff0cNumPy\u5e93\u4f1a\u88ab\u5bfc\u5165\u4e3a<code>np<\/code>\uff0c\u8fd9\u662f\u4e00\u4e2a\u666e\u904d\u7684\u7ea6\u5b9a\uff0c\u4ee5\u4fbf\u4e8e\u4f7f\u7528\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e8c\u3001\u521b\u5efa\u6570\u7ec4<\/p>\n<\/p>\n<p><p>\u4f7f\u7528NumPy\u521b\u5efa\u6570\u7ec4\u6709\u591a\u79cd\u65b9\u5f0f\uff0c\u6700\u5e38\u7528\u7684\u662f\u901a\u8fc7\u5217\u8868\u6216\u5143\u7ec4\u6765\u521b\u5efa\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4ece\u5217\u8868\u521b\u5efa\u6570\u7ec4<\/strong><\/p>\n<\/p>\n<p><p>\u53ef\u4ee5\u901a\u8fc7<code>numpy.array()<\/code>\u51fd\u6570\u5c06Python\u7684\u5217\u8868\u8f6c\u6362\u4e3aNumPy\u6570\u7ec4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<p>my_list = [1, 2, 3, 4, 5]<\/p>\n<p>my_array = np.array(my_list)<\/p>\n<p>print(my_array)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u8ff0\u4ee3\u7801\u5c06\u8f93\u51fa<code>[1 2 3 4 5]<\/code>\uff0c\u8fd9\u5c31\u662f\u4e00\u4e2a\u4e00\u7ef4\u7684NumPy\u6570\u7ec4\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528numpy\u51fd\u6570\u521b\u5efa\u6570\u7ec4<\/strong><\/p>\n<\/p>\n<p><p>NumPy\u63d0\u4f9b\u4e86\u8bb8\u591a\u51fd\u6570\u6765\u521b\u5efa\u6570\u7ec4\uff0c\u4f8b\u5982<code>arange()<\/code>, <code>zeros()<\/code>, <code>ones()<\/code>, <code>linspace()<\/code>\u7b49\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p><code>np.arange(start, stop, step)<\/code>\uff1a\u751f\u6210\u4e00\u4e2a\u4ece<code>start<\/code>\u5230<code>stop<\/code>\uff0c\u4ee5<code>step<\/code>\u4e3a\u6b65\u957f\u7684\u6570\u7ec4\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_array = np.arange(0, 10, 2)<\/p>\n<p>print(my_array)  # \u8f93\u51fa\uff1a[0 2 4 6 8]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><code>np.zeros(shape)<\/code>\uff1a\u521b\u5efa\u4e00\u4e2a\u6307\u5b9a\u5f62\u72b6\u7684\u5168\u96f6\u6570\u7ec4\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_array = np.zeros((3, 3))<\/p>\n<p>print(my_array)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>[[0. 0. 0.]<\/p>\n<p> [0. 0. 0.]<\/p>\n<p> [0. 0. 0.]]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><code>np.ones(shape)<\/code>\uff1a\u521b\u5efa\u4e00\u4e2a\u6307\u5b9a\u5f62\u72b6\u7684\u5168\u4e00\u6570\u7ec4\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_array = np.ones((2, 2))<\/p>\n<p>print(my_array)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>[[1. 1.]<\/p>\n<p> [1. 1.]]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><code>np.linspace(start, stop, num)<\/code>\uff1a\u5728\u6307\u5b9a\u7684\u95f4\u9694\u5185\u8fd4\u56de\u5747\u5300\u95f4\u9694\u7684\u6570\u5b57\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_array = np.linspace(0, 1, 5)<\/p>\n<p>print(my_array)  # \u8f93\u51fa\uff1a[0.   0.25 0.5  0.75 1.  ]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u6570\u7ec4\u7684\u57fa\u672c\u64cd\u4f5c<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6570\u7ec4\u7684\u7d22\u5f15\u548c\u5207\u7247<\/strong><\/p>\n<\/p>\n<p><p>NumPy\u6570\u7ec4\u7684\u7d22\u5f15\u548c\u5207\u7247\u4e0ePython\u5217\u8868\u975e\u5e38\u76f8\u4f3c\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u7d22\u5f15\u8bbf\u95ee\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_array = np.array([1, 2, 3, 4, 5])<\/p>\n<p>print(my_array[0])  # \u8f93\u51fa\uff1a1<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e5f\u53ef\u4ee5\u5bf9\u6570\u7ec4\u8fdb\u884c\u5207\u7247\u64cd\u4f5c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(my_array[1:4])  # \u8f93\u51fa\uff1a[2 3 4]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u7ec4\u7684\u5f62\u72b6<\/strong><\/p>\n<\/p>\n<p><p>\u6570\u7ec4\u7684\u5f62\u72b6\u662f\u4e00\u4e2a\u8868\u793a\u6570\u7ec4\u5728\u6bcf\u4e2a\u7ef4\u5ea6\u4e0a\u5927\u5c0f\u7684\u5143\u7ec4\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528<code>shape<\/code>\u5c5e\u6027\u67e5\u770b\u548c\u4fee\u6539\u6570\u7ec4\u7684\u5f62\u72b6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_array = np.array([[1, 2, 3], [4, 5, 6]])<\/p>\n<p>print(my_array.shape)  # \u8f93\u51fa\uff1a(2, 3)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8981\u4fee\u6539\u6570\u7ec4\u7684\u5f62\u72b6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>reshape()<\/code>\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">reshaped_array = my_array.reshape((3, 2))<\/p>\n<p>print(reshaped_array)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>[[1 2]<\/p>\n<p> [3 4]<\/p>\n<p> [5 6]]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u7ec4\u7684\u8fd0\u7b97<\/strong><\/p>\n<\/p>\n<p><p>NumPy\u652f\u6301\u5bf9\u6570\u7ec4\u8fdb\u884c\u5143\u7d20\u7ea7\u7684\u8fd0\u7b97\uff0c\u5982\u52a0\u3001\u51cf\u3001\u4e58\u3001\u9664\u7b49\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_array = np.array([1, 2, 3])<\/p>\n<p>print(my_array + 1)  # \u8f93\u51fa\uff1a[2 3 4]<\/p>\n<p>print(my_array * 2)  # \u8f93\u51fa\uff1a[2 4 6]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd8\u53ef\u4ee5\u5bf9\u4e24\u4e2a\u6570\u7ec4\u8fdb\u884c\u8fd0\u7b97\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">array1 = np.array([1, 2, 3])<\/p>\n<p>array2 = np.array([4, 5, 6])<\/p>\n<p>print(array1 + array2)  # \u8f93\u51fa\uff1a[5 7 9]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001NUMPY\u6570\u7ec4\u7684\u9ad8\u7ea7\u64cd\u4f5c<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6570\u7ec4\u7684\u5e7f\u64ad<\/strong><\/p>\n<\/p>\n<p><p>\u5e7f\u64ad\u662fNumPy\u4e2d\u7684\u4e00\u4e2a\u5f3a\u5927\u673a\u5236\uff0c\u5b83\u5141\u8bb8\u5bf9\u4e0d\u540c\u5f62\u72b6\u7684\u6570\u7ec4\u6267\u884c\u7b97\u672f\u8fd0\u7b97\u3002\u5e7f\u64ad\u4f1a\u81ea\u52a8\u6269\u5c55\u8f83\u5c0f\u7684\u6570\u7ec4\u4ee5\u5339\u914d\u8f83\u5927\u6570\u7ec4\u7684\u5f62\u72b6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_array = np.array([1, 2, 3])<\/p>\n<p>print(my_array + np.array([[1], [2], [3]]))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>[[2 3 4]<\/p>\n<p> [3 4 5]<\/p>\n<p> [4 5 6]]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u7ec4\u7684\u805a\u5408<\/strong><\/p>\n<\/p>\n<p><p>NumPy\u63d0\u4f9b\u4e86\u591a\u79cd\u7528\u4e8e\u6570\u7ec4\u805a\u5408\u7684\u51fd\u6570\uff0c\u4f8b\u5982<code>sum()<\/code>, <code>mean()<\/code>, <code>std()<\/code>\u7b49\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_array = np.array([[1, 2, 3], [4, 5, 6]])<\/p>\n<p>print(np.sum(my_array))      # \u8f93\u51fa\uff1a21<\/p>\n<p>print(np.mean(my_array))     # \u8f93\u51fa\uff1a3.5<\/p>\n<p>print(np.std(my_array))      # \u8f93\u51fa\uff1a1.707825127659933<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd8\u53ef\u4ee5\u6307\u5b9a\u8f74\u6765\u8fdb\u884c\u805a\u5408\u64cd\u4f5c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(np.sum(my_array, axis=0))  # \u8f93\u51fa\uff1a[5 7 9]<\/p>\n<p>print(np.sum(my_array, axis=1))  # \u8f93\u51fa\uff1a[ 6 15]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u7ec4\u7684\u6392\u5e8f<\/strong><\/p>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>numpy.sort()<\/code>\u51fd\u6570\u5bf9\u6570\u7ec4\u8fdb\u884c\u6392\u5e8f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_array = np.array([3, 1, 2])<\/p>\n<p>sorted_array = np.sort(my_array)<\/p>\n<p>print(sorted_array)  # \u8f93\u51fa\uff1a[1 2 3]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5bf9\u4e8c\u7ef4\u6570\u7ec4\uff0c\u53ef\u4ee5\u6307\u5b9a\u8f74\u8fdb\u884c\u6392\u5e8f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_array = np.array([[3, 2, 1], [6, 5, 4]])<\/p>\n<p>sorted_array = np.sort(my_array, axis=1)<\/p>\n<p>print(sorted_array)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>[[1 2 3]<\/p>\n<p> [4 5 6]]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u4e0e\u5176\u4ed6\u5e93\u7684\u7ed3\u5408<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4e0ePandas\u7ed3\u5408<\/strong><\/p>\n<\/p>\n<p><p>Pandas\u662fPython\u4e2d\u53e6\u4e00\u4e2a\u975e\u5e38\u6d41\u884c\u7684\u6570\u636e\u5206\u6790\u5e93\u3002NumPy\u6570\u7ec4\u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u8f6c\u6362\u4e3aPandas\u7684DataFrame\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p>my_array = np.array([[1, 2, 3], [4, 5, 6]])<\/p>\n<p>df = pd.DataFrame(my_array, columns=[&#39;A&#39;, &#39;B&#39;, &#39;C&#39;])<\/p>\n<p>print(df)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>   A  B  C<\/p>\n<p>0  1  2  3<\/p>\n<p>1  4  5  6<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4e0eMatplotlib\u7ed3\u5408<\/strong><\/p>\n<\/p>\n<p><p>Matplotlib\u662f\u4e00\u4e2a\u7528\u4e8e\u521b\u5efa\u9759\u6001\u3001\u52a8\u753b\u548c\u4ea4\u4e92\u5f0f\u53ef\u89c6\u5316\u7684\u7ed8\u56fe\u5e93\u3002NumPy\u6570\u7ec4\u53ef\u4ee5\u76f4\u63a5\u7528\u4e8e\u7ed8\u56fe\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>x = np.linspace(0, 10, 100)<\/p>\n<p>y = np.sin(x)<\/p>\n<p>plt.plot(x, y)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u5c06\u7ed8\u5236\u4e00\u4e2a\u4ece0\u523010\u7684\u6b63\u5f26\u6ce2\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7NumPy\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5feb\u6377\u5730\u8fdb\u884c\u6570\u7ec4\u7684\u521b\u5efa\u3001\u64cd\u4f5c\u548c\u5206\u6790\uff0c\u5e76\u4e14\u53ef\u4ee5\u4e0e\u5176\u4ed6\u5f3a\u5927\u7684\u6570\u636e\u79d1\u5b66\u5e93\u7ed3\u5408\u4f7f\u7528\uff0c\u6781\u5927\u5730\u63d0\u9ad8\u4e86\u6570\u636e\u5904\u7406\u7684\u6548\u7387\u548c\u7075\u6d3b\u6027\u3002\u65e0\u8bba\u662f\u6570\u636e\u5206\u6790\u3001\u79d1\u5b66\u8ba1\u7b97\uff0c\u8fd8\u662f<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\uff0cNumPy\u90fd\u662f\u4e00\u4e2a\u4e0d\u53ef\u6216\u7f3a\u7684\u5de5\u5177\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5bfc\u5165\u4e00\u4e2a\u5916\u90e8\u6570\u7ec4\u6587\u4ef6\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528NumPy\u5e93\u6765\u5bfc\u5165\u5916\u90e8\u6570\u7ec4\u6587\u4ef6\uff0c\u6bd4\u5982CSV\u6216TXT\u6587\u4ef6\u3002\u4f7f\u7528<code>numpy.loadtxt()<\/code>\u6216<code>numpy.genfromtxt()<\/code>\u53ef\u4ee5\u8f7b\u677e\u8bfb\u53d6\u8fd9\u4e9b\u6587\u4ef6\u3002\u786e\u4fdd\u5728\u5bfc\u5165\u4e4b\u524d\u5df2\u7ecf\u5b89\u88c5\u4e86NumPy\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip install numpy<\/code>\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<p><strong>\u6211\u53ef\u4ee5\u4f7f\u7528Python\u5bfc\u5165\u54ea\u4e9b\u7c7b\u578b\u7684\u6570\u7ec4\uff1f<\/strong><br \/>Python\u652f\u6301\u591a\u79cd\u7c7b\u578b\u7684\u6570\u7ec4\u5bfc\u5165\uff0c\u5e38\u89c1\u7684\u5305\u62ec\u4e00\u7ef4\u6570\u7ec4\u3001\u4e8c\u7ef4\u6570\u7ec4\u4ee5\u53ca\u591a\u7ef4\u6570\u7ec4\u3002\u4f7f\u7528NumPy\u5e93\u53ef\u4ee5\u5904\u7406\u8fd9\u4e9b\u4e0d\u540c\u7684\u6570\u7ec4\u7ed3\u6784\u3002\u540c\u65f6\uff0cPandas\u5e93\u4e5f\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u6570\u636e\u6846\u67b6\uff0c\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u5904\u7406\u548c\u5206\u6790\u8868\u683c\u6570\u636e\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Python\u4e2d\u521b\u5efa\u5e76\u5bfc\u5165\u81ea\u5b9a\u4e49\u6570\u7ec4\uff1f<\/strong><br \/>\u521b\u5efa\u81ea\u5b9a\u4e49\u6570\u7ec4\u7684\u65b9\u5f0f\u975e\u5e38\u7075\u6d3b\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u5185\u7f6e\u7684\u5217\u8868\u3001\u5143\u7ec4\u7b49\u6570\u636e\u7ed3\u6784\u3002\u82e5\u5e0c\u671b\u5c06\u8fd9\u4e9b\u6570\u636e\u8f6c\u6362\u4e3a\u6570\u7ec4\uff0c\u53ef\u4ee5\u5229\u7528NumPy\u7684<code>numpy.array()<\/code>\u51fd\u6570\u3002\u8fd9\u6837\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u4ee3\u7801\u4e2d\u76f4\u63a5\u5b9a\u4e49\u6570\u7ec4\u5185\u5bb9\u5e76\u5c06\u5176\u5bfc\u5165\u5230\u9879\u76ee\u4e2d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\u5bfc\u5165\u6570\u7ec4\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\uff0c\u4f8b\u5982\u4f7f\u7528\u5185\u7f6e\u7684\u5217\u8868\u3001NumPy\u5e93\u548cPandas\u5e93\u7b49\uff0c\u8fd9\u4e9b\u65b9\u6cd5\u5404\u6709\u4f18\u7f3a [&hellip;]","protected":false},"author":3,"featured_media":938361,"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\/938352"}],"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=938352"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/938352\/revisions"}],"predecessor-version":[{"id":938364,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/938352\/revisions\/938364"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/938361"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=938352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=938352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=938352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}