{"id":2092,"date":"2023-04-01T22:02:47","date_gmt":"2023-04-01T14:02:47","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=2092"},"modified":"2023-04-06T13:58:36","modified_gmt":"2023-04-06T05:58:36","slug":"numpy-quick-start-guide","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/04\/01\/numpy-quick-start-guide\/","title":{"rendered":"NumPy\u5feb\u901f\u5165\u95e8\u6307\u5357"},"content":{"rendered":"<h2>\u7b80\u4ecb<\/h2>\n<p>NumPy\u7cfb\u7edf\u662fPython\u7684\u4e00\u79cd\u5f00\u6e90\u7684\u6570\u503c\u8ba1\u7b97\u6269\u5c55\u3002\u8fd9\u79cd\u5de5\u5177\u53ef\u7528\u6765\u5b58\u50a8\u548c\u5904\u7406\u5927\u578b\u77e9\u9635\u3002<\/p>\n<p><!-- more --><\/p>\n<p>\u53c2\u8003\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/docs.scipy.org\/doc\/numpy\/user\/quickstart.html\">https:\/\/docs.scipy.org\/doc\/numpy\/user\/quickstart.html<\/a><br \/>\n100 numpy exercises\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/www.labri.fr\/perso\/nrougier\/teaching\/numpy.100\/\">http:\/\/www.labri.fr\/perso\/nrougier\/teaching\/numpy.100\/<\/a><br \/>\n\u8bd5\u9a8c\u6027\u7684Numpy\u6559\u7a0b\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/reverland.org\/python\/2012\/08\/22\/numpy\">http:\/\/reverland.org\/python\/2012\/08\/22\/numpy<\/a><br \/>\nFrom Python to Numpy\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/www.labri.fr\/perso\/nrougier\/from-python-to-numpy\/\">http:\/\/www.labri.fr\/perso\/nrougier\/from-python-to-numpy\/<\/a><\/p>\n<h2>\u5feb\u901f\u5165\u95e8\u6307\u5357<\/h2>\n<pre><code class=\"language-python\"># -*- coding: utf-8 -*-\nimport numpy as np\nfrom numpy import pi\nfrom numpy import newaxis\n\n&#039;&#039;&#039;\n[[ 0  1  2  3  4]\n [ 5  6  7  8  9]\n [10 11 12 13 14]]\n&lt;class &#039;numpy.ndarray&#039;&gt;\n2\n(3, 5)\n15\nint32\n4\n&lt;memory at 0x000001D910BB6DC8&gt;\n&#039;&#039;&#039;\ndef numpyBasic():\n    a = np.arange(15).reshape(3, 5)\n    print(a)\n    # \u5f53\u6570\u7ec4\u5305\u542b\u7684\u5143\u7d20\u592a\u591a\u65f6, \u4f1a\u7701\u7565\u4e2d\u95f4\u7684\u5143\u7d20, \u53ea\u6253\u5370\u89d2\u843d\u7684\u5143\u7d20\n    # \u5982\u679c\u60f3\u7981\u7528\u8fd9\u4e2a\u884c\u4e3a, \u5f3a\u5236\u6253\u5370\u6240\u6709\u7684\u5143\u7d20, \u53ef\u4ee5\u5f00\u542fset_printoptions\u9009\u9879: np.set_printoptions(threshold=np.nan)\n    # \u8fd8\u539f\u6210\u7701\u7565\u6548\u679c: np.set_printoptions(threshold=1000)\n    # \u8bbe\u7f6e\u6253\u5370\u6d6e\u70b9\u6570\u7684\u5c0f\u6570\u4f4d\u6570: np.set_printoptions(precision=4)  # \u8bbe\u7f6e\u6253\u5370\u6d6e\u70b9\u6570\u7684\u5c0f\u6570\u4f4d\u6570\uff0c\u9ed8\u8ba4\u662f8\u4f4d\n    print(type(a))\n    print(a.ndim)  # \u6570\u7ec4\u7684\u8f74\u6570(\u5373rank)\n    print(a.shape)  # \u6570\u7ec4\u7684\u7ef4\u5ea6\uff0c\u8fd4\u56de\u7684\u662f\u4e00\u4e2a\u5143\u7ec4\uff0c\u5143\u7ec4\u7684\u957f\u5ea6\u503c\u521a\u597d\u662fndim\n    print(a.size)  # \u6570\u7ec4\u5143\u7d20\u7684\u4e2a\u6570\n    print(a.dtype)  # \u6570\u7ec4\u5143\u7d20\u7684\u7c7b\u578b\n    print(a.itemsize)  # \u6570\u7ec4\u5143\u7d20\u7684\u5b57\u8282\u5927\u5c0f\n    print(a.data)  # \u6570\u7ec4\u5305\u542b\u7684\u5b9e\u9645\u6570\u636e(\u4e00\u822c\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u7528\u5230\u8fd9\u4e2a\u5c5e\u6027\uff0c\u90fd\u662f\u901a\u8fc7\u7d22\u5f15\u6765\u8bbf\u95ee\u5143\u7d20)\n\ndef numpyCreateArray():\n    # \u53ef\u4ee5\u4ece\u666e\u901a\u7684python\u5217\u8868\u6216\u5143\u7ec4\u6765\u521b\u5efa\n    a1 = np.array([2, 3, 4])\n    print(a1)\n    print(a1.dtype)\n    a2 = np.array([1.2, 3.5, 5.1])\n    print(a2.dtype)\n    a3 = np.array([(1.5, 2.3), (4, 5, 6)])\n    print(a3)\n    print(a3.dtype)\n    # \u5728\u521b\u5efa\u6570\u7ec4\u7684\u65f6\u5019, \u6307\u5b9a\u6570\u636e\u7c7b\u578b\n    a4 = np.array([[1, 2], [3, 4]], dtype=complex)\n    print(a4)\n    # zeros\u51fd\u6570\u521b\u5efa\u521d\u59cb\u503c\u4e3a0\u7684\u6570\u7ec4\n    a5 = np.zeros((3, 4))\n    print(a5)\n    # ones\u521b\u5efa\u521d\u59cb\u503c\u4e3a1\u7684\u6570\u7ec4\n    a6 = np.ones((3, 4))\n    print(a6)\n    # empty\u521b\u5efa\u672a\u521d\u59cb\u5316\u7684\u968f\u673a\u6570\u7ec4\n    a7 = np.empty((2, 5))\n    print(a7)\n    # \u4e3a\u4e86\u521b\u5efa\u5e8f\u5217\u51fd\u6570, Numpy\u4e5f\u63d0\u4f9b\u4e86\u7c7b\u4f3crange\u51fd\u6570\u7684\u65b9\u6cd5\n    a8 = np.arange(10, 30, 5)\n    print(a8)\n    a9 = np.arange(0, 2, 0.3)\n    print(a9)\n    a10 = np.linspace(0, 2, 9)\n    print(a10)\n    x = np.linspace(0, 2 * pi, 100)\n    f = np.sin(x)\n\n# \u6570\u7ec4\u7684\u7b97\u672f\u8fd0\u7b97\u4f1a\u81ea\u52a8\u4f5c\u7528\u4e8e\u6bcf\u4e2a\u5143\u7d20\uff0c\u5e76\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684\u6570\u7ec4\ndef numpyBaseAlgorithm():\n    a = np.array([20, 30, 40, 50])\n    b = np.arange(4)\n    c = a - b\n    print(c)\n    d = b**2\n    print(d)\n    e = 10 * np.sin(a)\n    print(e)\n    f = a &lt; 35\n    print(f)\n\n# *\u8fd4\u56de\u7684\u662f\u6bcf\u4e2a\u5143\u7d20\u76f8\u4e58\u7684\u7ed3\u679c, \u8981\u5b9e\u73b0\u77e9\u9635\u4e58\u6cd5, \u9700\u8981\u4f7f\u7528dot\u51fd\u6570\ndef numpyMatrixAlgorithm():\n    a = np.array([[1, 1],\n                  [0, 1]])\n    b = np.array([[2, 0],\n                  [3, 4]])\n    c = a * b  # \u5bf9\u5e94\u4f4d\u7f6e\u7684\u5143\u7d20\u76f8\u4e58\n    print(c)\n    d = a.dot(b)  # \u77e9\u9635\u4e58\u6cd5\n    print(d)\n    e = np.dot(a, b)  # \u53e6\u4e00\u79cd\u5f62\u5f0f\u7684\u77e9\u9635\u4e58\u6cd5\n    print(e)\n\n# \u4e00\u4e9b\u64cd\u4f5c, \u5982+=\u548c*=\u662f\u76f4\u63a5\u4fee\u6539\u539f\u6709\u7684\u6570\u7ec4, \u800c\u4e0d\u662f\u65b0\u5efa\u4e00\u4e2a\ndef numpyMatrixAlgorithmSelf():\n    a = np.ones((2, 3), dtype=int)\n    print(a)\n    b = np.random.random((2, 3))\n    print(b)\n    print(a.dtype)\n    print(b.dtype)\n    b += a\n    print(b)\n    # a += b\n    # print(a)\n\n# \u5f53\u4e0d\u540c\u7c7b\u578b\u7684\u6570\u7ec4\u8fd0\u7b97\u64cd\u4f5c\u65f6, \u603b\u662f\u5411\u7cbe\u5ea6\u66f4\u9ad8\u7684\u81ea\u52a8\u8f6c\u6362\ndef numpyMatrixAlgorithmPrecision():\n    a = np.ones(3, dtype=np.int32)\n    b = np.linspace(0, np.pi, 3)\n    c = a + b\n    print(c)\n    print(c.dtype)\n    d = np.exp(c * 1j)\n    print(d)\n    print(d.dtype)\n\n# ndarray\u5305\u542b\u4e86\u5f88\u591a\u4e00\u5143\u8fd0\u7b97. \u5982\u6c42\u548c\u7b49\ndef numpyMatrixAlgorithmUnary():\n    a = np.arange(15).reshape(3, 5)\n    print(a)\n    print(a.sum())\n    print(a.min())\n    print(a.max())\n\n# \u9ed8\u8ba4\u60c5\u51b5\u4e0b, \u6570\u7ec4\u64cd\u4f5c\u90fd\u662f\u4f5c\u7528\u4e8e\u6bcf\u4e00\u4e2a\u5143\u7d20, \u800c\u4e0d\u7ba1\u5b83\u7684\u7ef4\u5ea6. \u4f46\u662f, \u6211\u4eec\u4e5f\u53ef\u4ee5\u901a\u8fc7axis\u53c2\u6570\u6765\u9650\u5b9a\u64cd\u4f5c\u7684\u8f74\ndef numpyMatrixAlgorithmAxis():\n    a = np.arange(12).reshape(3, 4)\n    b = a.sum(axis=0)  # \u8ba1\u7b97\u6bcf\u4e00\u5217\u7684\u548c\n    print(b)\n    c = a.min(axis=1)  # \u8ba1\u7b97\u6bcf\u4e00\u884c\u7684\u6700\u5c0f\u503c\n    print(c)\n    d = a.cumsum(axis=1)  # \u6bcf\u4e00\u884c\u7d2f\u79ef\u548c\n    print(d)\n\n# Numpy\u63d0\u4f9b\u4e86\u5f88\u591a\u5e38\u89c1\u7684\u6570\u5b66\u4e0a\u7684\u8fd0\u7b97, \u5982sin, cos, exp. \u5728Numpy\u4e2d, \u6211\u4eec\u79f0\u8fd9\u4e9b\u4e3a&quot;universal functions&quot;(ufunc)\ndef numpyUniversal():\n    a = np.arange(3)\n    b = np.exp(a)\n    print(b)\n    c = np.sqrt(a)\n    print(c)\n    d = np.add(a, a)\n    print(d)\n\n&#039;&#039;&#039;\nint32\n[  0   1   8  27  64 125 216 343 512 729]\n8\n[ 8 27 64]\n[ 0  8 64]\n[1000    1 1000   27 1000  125  216  343  512  729]\n[ 729  512  343  216  125 1000   27 1000    1 1000]\n[1000    1 1000   27 1000  125  216  343  512  729]\n9.999999999999998 1.0 9.999999999999998 3.0 9.999999999999998 5.0 5.999999999999999 6.999999999999999 7.999999999999999 8.999999999999998 \n&#039;&#039;&#039;\n# \u4e00\u7ef4\u6570\u7ec4\u7684\u7d22\u5f15\uff0c\u5207\u7247\uff0c\u8fed\u4ee3\u8ddf\u666e\u901a\u7684Python\u5217\u8868\u4e00\u6837\ndef numpyArrayIndex():\n    a = np.arange(10) ** 3\n    print(a.dtype)\n    print(a)\n    print(a[2])\n    print(a[2:5])\n    print(a[:6:2])  # \u7b49\u4ef7\u4e8ea[0:6:2]\n    a[:6:2] = 1000\n    print(a)\n    print(a[::-1])  # \u53cd\u8f6c\u6570\u7ec4a\n    for i in a:\n        i **= (1 \/ 3.)\n    print(a)\n    for i in range(len(a)):\n        print(a[i] ** (1 \/ 3.), end=&#039; &#039;)\n\ndef f(x, y):\n    return 10*x + y\n\n&#039;&#039;&#039;\n[[ 0  1  2  3]\n [10 11 12 13]\n [20 21 22 23]\n [30 31 32 33]\n [40 41 42 43]]\n23\n[ 1 11 21 31 41]\n[ 1 11 21 31 41]\n[[10 11 12 13]\n [20 21 22 23]]\n&#039;&#039;&#039;\ndef numpyArrayMatrix():\n    a = np.fromfunction(f, (5, 4), dtype=int)\n    print(a)\n    # help(np.fromfunction)\n    print(a[2, 3])\n    print(a[0:5, 1])\n    print(a[:, 1])\n    print(a[1:3, :])\n    # \u5f53\u7d22\u5f15\u6570\u5c11\u4e8e\u8f74\u6570\u65f6\uff0c\u7f3a\u5931\u7684\u7d22\u5f15\u8ba4\u4e3a\u662f\u5168\u5207\u7247\n    print(a[-1])  # \u7b49\u4ef7\u4e8e a[-1, :]\n\n# \u53ef\u4ee5\u4f7f\u7528...\u6765\u8868\u793a\u5168\u5207\u7247\uff0c\u5b83\u4ee3\u8868\u8865\u5168\u5269\u4e0b\u7684\u6240\u6709\u7d22\u5f15\n# x[1,2,...]\u7b49\u4ef7\u4e8ex[1,2,:,:,:]\n# x[...,3]\u7b49\u4ef7\u4e8ex[:,:,:,:,3]\n# x[4,...,5,:]\u7b49\u4ef7\u4e8ex[4,:,:,5,:]\ndef numpyArrayDot():\n    a = np.array([[[0, 1, 2],\n                  [10, 12, 13]],\n                  [[100, 101, 102],\n                  [110, 112, 113]]])\n    print(a.shape)\n    print(a[1, ...])\n    print(a[..., 2])\n\n&#039;&#039;&#039;\n[0 1 2 3]\n[10 11 12 13]\n[20 21 22 23]\n[30 31 32 33]\n[40 41 42 43]\n0 1 2 3 10 11 12 13 20 21 22 23 30 31 32 33 40 41 42 43 \n&#039;&#039;&#039;\ndef numpyMatrixEnumerate():\n    a = np.array([[0,  1,  2,  3],\n        [10, 11, 12, 13],\n        [20, 21, 22, 23],\n        [30, 31, 32, 33],\n        [40, 41, 42, 43]])\n    # \u591a\u7ef4\u6570\u7ec4\u7684\u8fed\u4ee3\u662f\u6839\u636e\u7b2c\u4e00\u4e2a\u8f74\u6765\u64cd\u4f5c\u7684\n    for row in a:\n        print(row)\n    # \u5982\u679c\u60f3\u904d\u5386\u6bcf\u4e2a\u5143\u7d20\uff0c\u53ef\u4ee5\u4f7f\u7528flat\u5c5e\u6027\n    for element in a.flat:\n        print(element, end=&#039; &#039;)\n\n&#039;&#039;&#039;\n(3, 4)\n[[0. 8. 3. 0.]\n [5. 2. 3. 5.]\n [4. 6. 2. 3.]]\n[0. 8. 3. 0. 5. 2. 3. 5. 4. 6. 2. 3.]\n[[0. 8.]\n [3. 0.]\n [5. 2.]\n [3. 5.]\n [4. 6.]\n [2. 3.]]\n[[0. 5. 4.]\n [8. 2. 6.]\n [3. 3. 2.]\n [0. 5. 3.]]\n(4, 3)\n[[0. 8. 3. 0. 5. 2.]\n [3. 5. 4. 6. 2. 3.]]\n[[0. 8. 3. 0.]\n [5. 2. 3. 5.]\n [4. 6. 2. 3.]]\n&#039;&#039;&#039;\ndef numpyMatrixShape():\n    a = np.floor(10 * np.random.random((3, 4)))\n    print(a.shape)\n    print(a)\n    # \u8fd4\u56de\u964d\u7ef4\u7684\u6570\u7ec4\n    print(a.ravel())\n    # \u76f4\u63a5\u4fee\u6539shape\n    print(a.reshape(6, 2))\n    # \u6570\u7ec4\u8f6c\u7f6e\n    print(a.T)\n    print(a.T.shape)\n    # reshape\u8fd4\u56de\u4fee\u6539\u540e\u7684\u6570\u7ec4\uff0c\u4e0d\u6539\u53d8\u6570\u7ec4\u672c\u8eab\uff0c\u4f46\u662fresize\u51fd\u6570\u76f4\u63a5\u4fee\u6539\u539f\u6570\u7ec4\n    a.resize((2, 6))\n    print(a)\n    # \u5982\u679c\u4e00\u4e2a\u7ef4\u5ea6\u4e3a\u7684\u662f-1, \u90a3\u4e48reshape\u51fd\u6570\u4f1a\u81ea\u52a8\u8ba1\u7b97\u5b83\u7684\u503c\n    print(a.reshape(3, -1))\n\n&#039;&#039;&#039;\n[[3. 0.]\n [3. 9.]]\n[[9. 4.]\n [8. 1.]]\n[[3. 0.]\n [3. 9.]\n [9. 4.]\n [8. 1.]]\n[[3. 0. 9. 4.]\n [3. 9. 8. 1.]]\n&#039;&#039;&#039;\ndef numpyMatrixCombine():\n    # \u591a\u4e2a\u6570\u7ec4\u53ef\u4ee5\u6839\u636e\u4e0d\u540c\u7684\u8f74\u7ec4\u5408\u5728\u4e00\u8d77\n    a = np.floor(10 * np.random.random((2, 2)))\n    print(a)\n    b = np.floor(10 * np.random.random((2, 2)))\n    print(b)\n    print(np.vstack((a, b)))\n    print(np.hstack((a, b)))\n\n&#039;&#039;&#039;\n[[1. 1. 2. 9.]\n [4. 4. 0. 3.]]\n[[4. 3.]\n [2. 8.]]\n[[4.]\n [2.]]\n[[4. 3.]\n [2. 8.]]\n[[4. 3.]\n [2. 8.]]\n[1 2 3 0 4]\n&#039;&#039;&#039;\n## \u6570\u7ec4\u5408\u5e76\ndef numpyColumnStack():\n    a = np.array([[1., 1.], [4., 4.]])\n    b = np.array([[2., 9.], [0., 3.]])\n    # \u64cd\u4f5c2\u7ef4\u6570\u7ec4\uff0c\u7b49\u6548\u4e8ehstack\n    print(np.column_stack((a, b)))\n    a = np.array([4., 2.])\n    b = np.array([3., 8.])\n    # \u64cd\u4f5c1\u7ef4\u6570\u7ec4\uff0c\u8fd4\u56de2\u7ef4\u6570\u7ec4\uff0ca,b\u5206\u522b\u4e3a2\u7ef4\u6570\u7ec4\u7684\u5217\n    print(np.column_stack((a, b)))\n    # \u5c061\u7ef4\u6570\u7ec4\u53d8\u62102\u7ef4\u6570\u7ec4\n    print(a[:, newaxis])\n    # \u90fd\u662f\u64cd\u4f5c\u4e8c\u7ef4\u6570\u7ec4\uff0c\u4e0b\u9762\u4e24\u4e2a\u64cd\u4f5ccolumn_stack\u548chstack\u7b49\u6548\n    print(np.column_stack((a[:, newaxis], b[:, newaxis])))\n    print(np.hstack((a[:, newaxis], b[:, newaxis])))\n    # \u53e6\u5916\u4e0d\u8bba\u4ec0\u4e48\u6570\u7ec4\uff0crow_stack\u51fd\u6570\u7b49\u6548\u4e8evstack\n    # \u901a\u5e38\u6765\u8bf4\uff0c2\u7ef4\u4ee5\u4e0a\u7684\u6570\u7ec4\uff0chstack\u57fa\u4e8e\u7b2c2\u6839\u8f74\u505a\u8fd0\u7b97\uff0cvstack\u57fa\u4e8e\u7b2c1\u6839\u8f74\n    # concatenate\u51fd\u6570\u989d\u5916\u591a\u63a5\u53d7\u4e00\u4e2a\u53c2\u6570\uff0c\u53ef\u4ee5\u6307\u5b9a\u57fa\u4e8e\u54ea\u6839\u8f74\u505a\u6570\u7ec4\u7684\u5408\u5e76\u64cd\u4f5c\n    # \u53e6\u5916, r_\u548cc_\u51fd\u6570\u5bf9\u4e8e\u5728\u4e00\u4e2a\u8f74\u4e0a\u7ec4\u5408\u6570\u636e\u76f8\u5f53\u5b9e\u7528\uff0c\u4ed6\u4eec\u5141\u8bb8\u4f7f\u7528\u8303\u56f4\u7b26\u53f7\n    print(np.r_[1:4, 0, 4])\n\n## \u6570\u7ec4\u5207\u5272\ndef numpyMatrixSplit():\n    a = np.array([[ 9.,  0.,  2.,  0.,  0.,  4.,  1.,  6.,  4.,  8.,  3.,  9.],\n       [ 5.,  3.,  0.,  5.,  5.,  8.,  0.,  5.,  6.,  3.,  8.,  7.]])\n    print(a)\n    # \u6a2a\u8f74\u5207\u5272\u62103\u4e2a\u6570\u7ec4\n    print(np.hsplit(a, 3))\n    # \u7eb5\u8f74\u5207\u5272\u62102\u4e2a\u6570\u7ec4\n    # vsplit\u53ef\u4ee5\u57fa\u4e8e\u5782\u76f4\u8f74\u5207\u5272\uff0carray_split\u53ef\u4ee5\u6307\u5b9a\u57fa\u4e8e\u54ea\u4e2a\u8f74\u5207\u5272\n    print(np.vsplit(a, 2))\n    # \u57fa\u4e8e\u7b2c3\u548c\u7b2c4\u5217\u5207\u5272\n    print(np.hsplit(a, (3, 4)))\n\ndef f(x):\n    print(id(x))\n\n&#039;&#039;&#039;\n[ 0  1  2  3  4  5  6  7  8  9 10 11]\nTrue\n(12,)\n(3, 4)\n[[ 0  1  2  3]\n [ 4  5  6  7]\n [ 8  9 10 11]]\n2889321266432\n2889321266432\n- - - - - - - - - - - - - - - - - - - -\nFalse\nTrue\nFalse\n(3, 4)\n[[   0    1    2    3 1234    5]\n [   6    7    8    9   10   11]]\n[[   0    1    2    3]\n [1234    5    6    7]\n [   8    9   10   11]]\n[[ 1  2]\n [ 5  6]\n [ 9 10]]\n[[10 10]\n [10 10]\n [10 10]]\n[[   0   10   10    3]\n [1234   10   10    7]\n [   8   10   10   11]]\n- - - - - - - - - - - - - - - - - - - -\n[[ 0  1  2  3]\n [ 4  5  6  7]\n [ 8  9 10 11]]\nFalse\nFalse\n[[9999    1    2    3]\n [   4    5    6    7]\n [   8    9   10   11]]\n[[ 0  1  2  3]\n [ 4  5  6  7]\n [ 8  9 10 11]]\n&#039;&#039;&#039;\n# \u5f53\u8fdb\u884c\u6570\u7ec4\u8fd0\u7b97\u548c\u6539\u53d8\u6570\u7ec4\u65f6\uff0c\u6709\u65f6\u5019\u6570\u636e\u662f\u88ab\u590d\u5236\u5230\u4e00\u4e2a\u65b0\u7684\u6570\u7ec4\uff0c\u6709\u65f6\u5019\u4e0d\u662f\ndef numpyCopy():\n    ## \u4e0d\u590d\u5236\n    a = np.arange(12)\n    print(a)\n    b = a  # \u4e0d\u4f1a\u6709\u65b0\u5bf9\u8c61\u4ea7\u751f\n    print(b is a)  # a\u548cb\u662f\u540c\u4e00\u4e2a\u6570\u7ec4\n    print(b.shape)\n    b.shape = 3, 4  # \u6539\u53d8b\u7684shape, a\u4e5f\u540c\u6837\u53d8\u5316\n    print(a.shape)\n    print(a)\n    # Python\u4e2d\u4f7f\u7528\u53ef\u53d8\u53c2\u6570\u65f6\uff0c\u53ef\u4ee5\u770b\u505a\u662f\u5f15\u7528\u4f20\u53c2\uff0c\u56e0\u6b64\u51fd\u6570\u8c03\u7528\u4f1a\u4ea7\u751f\u65b0\u7684\u6570\u7ec4\n    print(id(a))\n    f(a)\n\n    print(&#039;- - - - - - - - - - - - - - - - - - - -&#039;)\n\n    ## \u89c6\u56fe(View)\u548c\u6d45\u590d\u5236(Shallow Copy)\n    # \u4e0d\u540c\u7684\u6570\u7ec4\u53ef\u4ee5\u5171\u4eab\u6570\u636e\uff0cview\u51fd\u6570\u53ef\u4ee5\u521b\u9020\u4e00\u4e2a\u6570\u636e\u76f8\u540c\u7684\u65b0\u6570\u7ec4\n    a = np.array([[0, 1, 2, 3],\n           [4, 5, 6, 7],\n           [8, 9, 10, 11]])\n    c = a.view()\n    print(c is a)  # c\u548ca\u4e0d\u662f\u540c\u4e00\u4e2a\u6570\u7ec4\n    print(c.base is a)  # c\u662fa\u7684\u6570\u636e\u7684\u89c6\u56fe\n    print(c.flags.owndata)\n    c.shape = 2, 6  # a\u7684\u4e0d\u4f1a\u6539\u53d8\n    print(a.shape)\n    c[0, 4] = 1234  # a\u7684\u6570\u636e\u53d1\u751f\u6539\u53d8\n    print(c)\n    print(a)\n    # \u4e00\u4e2a\u6570\u7ec4\u7684\u5207\u7247\u8fd4\u56de\u7684\u5c31\u662f\u5b83\u7684\u89c6\u56fe\n    s = a[:, 1:3]  # s\u662fa\u7684\u89c6\u56fe\n    print(s)\n    s[:] = 10  # s[:]\u662fa\u7684\u89c6\u56fe\n    print(s)\n    print(a)\n\n    print(&#039;- - - - - - - - - - - - - - - - - - - -&#039;)\n\n    ## \u6df1\u5ea6\u590d\u5236(Deep Copy)\n    a = np.arange(12).reshape((3, 4))\n    print(a)\n    d = a.copy()\n    print(d is a)\n    print(d.base is a)\n    d[0, 0] = 9999\n    print(d)\n    print(a)\n\n## \u5e7f\u64ad\u673a\u5236\ndef numpyBroadcast():\n    # \u5e7f\u64ad\u4e3b\u8981\u63cf\u8ff0\u4e8enumpy\u5bf9\u4e8e\u4e0d\u540cshape\u7684\u6570\u7ec4\u5982\u4f55\u8fdb\u884c\u7b97\u672f\u8fd0\u7b97\u3002\u53d7\u9650\u4e8e\u4e00\u4e9b\u7279\u5b9a\u7ea6\u675f\n    # \u4e00\u822c\u90fd\u662f\u5c0f\u7684\u6570\u7ec4\u6269\u5c55\u4e3a\u5927\u7684\u6570\u7ec4\uff0c\u4ee5\u4fbf\u80fd\u8ba1\u7b97\n    # \u901a\u5e38\u60c5\u51b5\u4e0b\uff0cnumpy\u64cd\u4f5c\u7684\u6570\u7ec4\u5fc5\u987b\u662f\u76f8\u540cshape\u7684\n    a = np.array([1.0, 2.0, 3.0])\n    b = np.array([2.0, 2.0, 2.0])\n    print(a * b)\n    # \u5f53\u6570\u7ec4\u7684shape\u6ee1\u8db3\u67d0\u4e9b\u7279\u5b9a\u7ea6\u675f\u65f6\uff0cnumpy\u7684\u5e7f\u64ad\u673a\u5236\u53ef\u4ee5\u4f7f\u8fd9\u4e2a\u7ea6\u675f\u66f4\u5bbd\u677e\u3002\u6700\u7b80\u5355\u7684\u5c31\u662f\u5e7f\u64ad\u4f8b\u5b50\u5c31\u662f\u5f53\u6570\u7ec4\u548c\u4e00\u4e2a\u6807\u91cf\u64cd\u4f5c\u65f6\n    a = np.array([1.0, 2.0, 3.0])\n    b = 2.0\n    print(a * b)\n    # \u6211\u4eec\u53ef\u4ee5\u8ba4\u4e3a\u6807\u91cfb\u88ab\u6269\u5c55\u4e3a\u4e86\u548ca\u540c\u6837shape\u7684\u6570\u7ec4\uff0cb\u4e2d\u7684\u65b0\u5143\u7d20\u5c31\u662f\u539f\u6765\u6807\u91cf\u7684\u62f7\u8d1d\n    # \u8fd9\u4e2a\u6269\u5c55\u7b56\u7565\u4ec5\u4ec5\u662f\u6982\u5ff5\u4e0a\u7684\uff0c\u5b9e\u9645\u4e0aNumpy\u8db3\u591f\u806a\u660e\uff0c\u80fd\u81ea\u52a8\u4f7f\u7528\u6807\u91cf\u505a\u8fd0\u7b97\uff0c\u800c\u4e0d\u9700\u8981\u590d\u5236\u4efb\u4f55\u4e1c\u897f\n    # \u6240\u4ee5\u5e7f\u64ad\u8fd0\u7b97\u4ece\u8ba1\u7b97\u5185\u5b58\u4e0a\u6765\u8bf4\u66f4\u4f18\u79c0\n    # \u8981\u80fd\u6ee1\u8db3\u5e7f\u64ad\uff0c\u5fc5\u987b\u7b26\u5408\u4e0b\u9762\u4e24\u6761\u89c4\u5219\uff1a\n    # 1. \u5e7f\u64ad\u4e4b\u540e\uff0c\u8f93\u51fa\u6570\u7ec4\u7684shape\u662f\u8f93\u5165\u6570\u7ec4shape\u7684\u5404\u4e2a\u8f74\u4e0a\u7684\u6700\u5927\u503c\uff0c\u7136\u540e\u6cbf\u7740\u8f83\u5927shape\u5c5e\u6027\u7684\u65b9\u5411\u590d\u5236\u5ef6\u4f38\n    # 2. \u8981\u8fdb\u884c\u5e7f\u64ad\u673a\u5236\uff0c\u8981\u4e48\u4e24\u4e2a\u6570\u7ec4\u7684shape\u5c5e\u6027\u4e00\u6837\uff0c\u8981\u4e48\u5176\u4e2d\u6709\u4e00\u4e2a\u6570\u7ec4\u7684shape\u5c5e\u6027\u5fc5\u987b\u6709\u4e00\u4e2a\u7b49\u4e8e1\n\n&#039;&#039;&#039;\n[  0   1   4   9  16  25  36  49  64  81 100 121]\n[1 1 3 8 5]\n  print(a[k])  # \u7b49\u4ef7\u4e8ea[i, j]\n[ 1  1  9 64 25]\n[[ 9 16]\n [81 49]]\n- - - - - - - - - - - - - - - - - - - -\n[[[  0   0   0]\n  [255   0   0]\n  [  0 255   0]\n  [  0   0   0]]\n\n [[  0   0   0]\n  [  0   0 255]\n  [255 255 255]\n  [  0   0   0]]]\n- - - - - - - - - - - - - - - - - - - -\n[[ 0  1  2  3]\n [ 4  5  6  7]\n [ 8  9 10 11]]\n[[ 2  5]\n [ 7 11]]\n[[ 2  6]\n [ 6 10]]\n(3, 2, 2)\n[[[ 2  1]\n  [ 3  3]]\n\n [[ 6  5]\n  [ 7  7]]\n\n [[10  9]\n  [11 11]]]\n[array([[0, 1],\n       [1, 2]]), array([[2, 1],\n       [3, 3]])]\n[[ 2  5]\n [ 7 11]]\n[[[0 1]\n  [1 2]]\n\n [[2 1]\n  [3 3]]]\n- - - - - - - - - - - - - - - - - - - -\n[0 1 2 3 4]\n[0 0 2 0 0]\n[0 1 2 3 4]\n[2 1 3 3 4]\n[0 1 2 3 4]\n[1 1 3 3 4]\n- - - - - - - - - - - - - - - - - - - -\n[[ 0  1  2  3]\n [ 4  5  6  7]\n [ 8  9 10 11]]\n[[False False False False]\n [False  True  True  True]\n [ True  True  True  True]]\n[ 5  6  7  8  9 10 11]\n[[0 1 2 3]\n [4 0 0 0]\n [0 0 0 0]]\n- - - - - - - - - - - - - - - - - - - -\n[[ 0  1  2  3]\n [ 4  5  6  7]\n [ 8  9 10 11]]\n[[ 4  5  6  7]\n [ 8  9 10 11]]\n[[ 4  5  6  7]\n [ 8  9 10 11]]\n[[ 0  2]\n [ 4  6]\n [ 8 10]]\n[ 4 10]\n&#039;&#039;&#039;\n## \u7d22\u5f15\ndef numpyIndices():\n    # numpy\u9664\u4e86\u652f\u6301\u666e\u901a\u7684python\u65b9\u5f0f\u7684\u7d22\u5f15\u548c\u5207\u7247\u4e4b\u5916\uff0c\u8fd8\u652f\u6301\u6574\u6570\u6570\u7ec4\u6216\u5e03\u5c14\u6570\u7ec4\u7d22\u5f15\n    a = np.arange(12) ** 2\n    i = np.array([1, 1, 3, 8, 5])\n    print(a)\n    print(i)\n    print(a[i])  # \u8fd4\u56dea\u4e2d\u518d\u7d22\u5f15i\u7684\u5143\u7d20\n    j = np.array([[3, 4], [9, 7]])\n    print(a[j])  # \u4e8c\u7ef4\u6570\u7ec4\u7d22\u5f15\uff0c\u8fd4\u56dea\u4e2d\u518d\u7d22\u5f15j\u7684\u5143\u7d20\n\n    print(&#039;- - - - - - - - - - - - - - - - - - - -&#039;)\n\n    # \u5f53\u6570\u7ec4\u7d22\u5f15\u4f5c\u7528\u5728\u591a\u7ef4\u6570\u7ec4\u65f6\uff0c\u662f\u6839\u636e\u6570\u7ec4\u7684\u7b2c\u4e00\u4e2a\u7ef4\u5ea6\u6765\u7d22\u5f15\u7684\n    palette = np.array([[0, 0, 0],\n                        [255, 0, 0],\n                        [0, 255, 0],\n                        [0, 0, 255],\n                        [255, 255, 255]])\n    image = np.array([[0, 1, 2, 0],\n                      [0, 3, 4, 0]])\n    print(palette[image])\n\n    print(&#039;- - - - - - - - - - - - - - - - - - - -&#039;)\n\n    # \u7d22\u5f15\u540c\u6837\u53ef\u4ee5\u662f\u591a\u7ef4\u7684\uff0c\u4f46\u662f\u5fc5\u987b\u662f\u76f8\u540c\u7684shape\n    a = np.arange(12).reshape(3, 4)\n    print(a)\n    i = np.array([[0, 1],\n                  [1, 2]])\n    j = np.array([[2, 1],\n                  [3, 3]])\n    print(a[i, j])\n    print(a[i, 2])\n    b = a[:, j]  # a[0, j], a[1, j], a[2, j]\n    print(b.shape)\n    print(b)\n    # \u540c\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u628ai\u548cj\u653e\u5728\u4e00\u4e2a\u5217\u8868\u91cc\uff0c\u7136\u540e\u7528\u5217\u8868\u505a\u7d22\u5f15\n    k = [i, j]\n    print(k)\n    print(a[k])  # \u7b49\u4ef7\u4e8ea[i, j]\n    s = np.array([i, j])  # \u4e09\u7ef4\u6570\u7ec4\n    print(s)\n\n    print(&#039;- - - - - - - - - - - - - - - - - - - -&#039;)\n\n    # \u540c\u6837\u53ef\u4ee5\u7ed9\u6570\u7ec4\u7d22\u5f15\u8d4b\u503c\n    a = np.arange(5)\n    print(a)\n    a[[1, 3, 4]] = 0\n    print(a)\n    # \u4f46\u662f\u5f53\u5217\u8868\u5305\u542b\u76f8\u540c\u7684\u7d22\u5f15\u65f6\uff0c\u8fd9\u4e2a\u4f4d\u7f6e\u4f1a\u88ab\u8d4b\u503c\u591a\u6b21\uff0c\u6700\u7ec8\u53ea\u4fdd\u7559\u6700\u540e\u4e00\u6b21\u7684\u503c\n    a = np.arange(5)\n    print(a)\n    a[[0, 0, 2]] = [1, 2, 3]\n    print(a)\n    # \u4e0a\u9762\u770b\u8d77\u6765\u5f88\u5408\u7406\uff0c\u4f46\u662f\u5f53\u4f7f\u7528+=\u7b26\u53f7\u7684\u65f6\u5019\uff0c\u7ed3\u679c\u548c\u6211\u4eec\u60f3\u7684\u53ef\u80fd\u4e0d\u592a\u4e00\u6837\n    a = np.arange(5)\n    print(a)\n    a[[0, 0, 2]] += 1  # \u5c3d\u7ba1\u7d22\u5f15\u4e2d\u51fa\u73b0\u4e86\u4e24\u6b210\uff0c\u4f46\u662f\u7b2c0\u4e2a\u5143\u7d20\u5b83\u53ea\u52a0\u4e861\u6b21\n    print(a)\n\n    print(&#039;- - - - - - - - - - - - - - - - - - - -&#039;)\n\n    # \u5e03\u5c14\u6570\u7ec4\u7d22\u5f15\n    # \u5f53\u4f7f\u7528\u6570\u5b57\u6570\u7ec4\u7d22\u5f15\u65f6\uff0c\u6211\u4eec\u63d0\u4f9b\u4e86\u54ea\u4e9b\u5143\u7d20\u8981\u88ab\u7d22\u5f15\u7684\u4fe1\u606f\n    # \u4f46\u662f\u5f53\u4f7f\u7528\u5e03\u5c14\u6570\u7ec4\u65f6\uff0c\u6211\u4eec\u662f\u660e\u786e\u54ea\u4e9b\u5143\u7d20\u9700\u8981\uff0c\u54ea\u4e9b\u5143\u7d20\u4e0d\u9700\u8981\n    a = np.arange(12).reshape((3, 4))\n    print(a)\n    b = a &gt; 4\n    print(b)\n    print(a[b])\n    a[b] = 0  # \u6240\u6709\u5927\u4e8e4\u7684\u5143\u7d20\u90fd\u8d4b\u503c\u4e3a0\n    print(a)\n\n    print(&#039;- - - - - - - - - - - - - - - - - - - -&#039;)\n\n    a = np.arange(12).reshape(3, 4)\n    b1 = np.array([False, True, True])\n    b2 = np.array([True, False, True, False])\n    print(a)\n    print(a[b1, :])  # \u9009\u62e9\u884c\n    print(a[b1])  # \u540c\u4e0a\n    print(a[:, b2])  # \u9009\u62e9\u5217\n    print(a[b1, b2])\n\n&#039;&#039;&#039;\n(2, 3., b&#039;World&#039;)\n[1 2]\n[2. 3.]\n[b&#039;Hello&#039; b&#039;World&#039;]\n&#039;&#039;&#039;\n## \u5b57\u7b26\u4e32\u7d22\u5f15\n# Numpy\u63d0\u4f9b\u4e86\u521b\u5efa\u7ed3\u6784\u5316\u7684\u6570\u7ec4\u7684\u80fd\u529b\uff0c\u53ef\u4ee5\u901a\u8fc7\u5217\u540d\u6765\u64cd\u4f5c\u6570\u636e\ndef numpyStringIndices():\n    # Numpy\u63d0\u4f9b\u4e86\u521b\u5efa\u7ed3\u6784\u5316\u7684\u6570\u7ec4\u7684\u80fd\u529b\uff0c\u53ef\u4ee5\u901a\u8fc7\u5217\u540d\u6765\u64cd\u4f5c\u6570\u636e\n    x = np.array([(1, 2., &#039;Hello&#039;), (2, 3., &#039;World&#039;)], dtype=[(&#039;foo&#039;, &#039;i4&#039;), (&#039;bar&#039;, &#039;f4&#039;), (&#039;baz&#039;, &#039;S10&#039;)])\n    print(x[1])\n    print(x[&#039;foo&#039;])\n    print(x[&#039;bar&#039;])\n    print(x[&#039;baz&#039;])\n\nif __name__ == &#039;__main__&#039;:\n    numpyBasic()\n    # numpyCreateArray()\n    # numpyBaseAlgorithm()\n    # numpyMatrixAlgorithm()\n    # numpyMatrixAlgorithmSelf()\n    # numpyMatrixAlgorithmPrecision()\n    # numpyMatrixAlgorithmUnary()\n    # numpyMatrixAlgorithmAxis()\n    # numpyUniversal()\n    # numpyArrayIndex()\n    # numpyArrayMatrix()\n    # numpyArrayDot()\n    # numpyMatrixEnumerate()\n    # numpyMatrixShape()\n    # numpyMatrixCombine()\n    # numpyColumnStack()\n    # numpyMatrixSplit()\n    # numpyCopy()\n    # numpyBroadcast()\n    # numpyIndices()\n    # numpyStringIndices()\n<\/code><\/pre>\n<h2>\u51fd\u6570\u548c\u65b9\u6cd5\u6982\u89c8<\/h2>\n<p>\u5982\u4e0b\u662f\u6309\u7167\u5206\u7c7b\u6574\u7406\u7684\u5e38\u7528\u51fd\u6570\u548c\u65b9\u6cd5\uff0c\u5b8c\u6574\u7684\u5206\u7c7b\u53ef\u4ee5\u53c2\u8003<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/docs.scipy.org\/doc\/numpy\/reference\/routines.html\" title=\"Routines\">Routines<\/a><\/p>\n<h3>\u6570\u7ec4\u521b\u5efa<\/h3>\n<ul>\n<li>arange<\/li>\n<li>array<\/li>\n<li>copy<\/li>\n<li>empty<\/li>\n<li>empty_like<\/li>\n<li>eye  # \u521b\u5efa\u4e00\u4e2a\u5bf9\u89d2\u7ebf\u5168\u662f1\u7684\u4e8c\u7ef4\u6570\u7ec4<\/li>\n<li>fromfile<\/li>\n<li>fromfunction<\/li>\n<li>identity  # \u521b\u5efa\u4e00\u4e2a\u5bf9\u89d2\u7ebf\u5168\u662f1\u7684\u65b9\u5f62\u77e9\u9635\uff0c\u4e0eeye\u65b9\u6cd5\u5dee\u4e0d\u591a\uff0c\u53ea\u662f\u53ef\u4ee5\u63a5\u53d7\u7684\u53c2\u6570\u4e0d\u540c<\/li>\n<li>linspace<\/li>\n<li>logspace  # \u521b\u5efa\u7b49\u6bd4\u6570\u5217<\/li>\n<li>mgrid<\/li>\n<li>orgid<\/li>\n<li>ones<\/li>\n<li>ones_like<\/li>\n<li>zeros<\/li>\n<li>zeros_like<\/li>\n<\/ul>\n<h3>\u8f6c\u6362<\/h3>\n<ul>\n<li>ndarray.astype  # \u6539\u53d8\u6570\u7ec4\u7684\u5143\u7d20\u683c\u5f0f<\/li>\n<li>atleast_1d  # \u5c06\u8f93\u5165\u8f6c\u6362\u4e3a\u81f3\u5c111\u7ef4\u6570\u7ec4<\/li>\n<li>atleast_2d<\/li>\n<li>alteast_3d<\/li>\n<li>mat  # \u5c06\u8f93\u5165\u8f6c\u6362\u4e3a\u77e9\u9635<\/li>\n<\/ul>\n<h3>\u5904\u7406<\/h3>\n<ul>\n<li>array_split<\/li>\n<li>column_stack<\/li>\n<li>concatenate<\/li>\n<li>diagonal<\/li>\n<li>dsplit<\/li>\n<li>dstack<\/li>\n<li>hsplit<\/li>\n<li>hstack<\/li>\n<li>ndarray.item<\/li>\n<li>newaxis<\/li>\n<li>ravel<\/li>\n<li>repeat<\/li>\n<li>reshape<\/li>\n<li>resize<\/li>\n<li>squeeze<\/li>\n<li>swapaxes<\/li>\n<li>take<\/li>\n<li>transpose<\/li>\n<li>vsplit<\/li>\n<li>vstack<\/li>\n<\/ul>\n<h3>Questions<\/h3>\n<ul>\n<li>all<\/li>\n<li>any<\/li>\n<li>nonezero<\/li>\n<li>where<\/li>\n<\/ul>\n<h3>\u6392\u5e8f<\/h3>\n<ul>\n<li>argmax  # \u8fd4\u56de\u6700\u5927\u503c\u7684\u7d22\u5f15<\/li>\n<li>argmin  # \u8fd4\u56de\u6700\u5c0f\u503c\u7684\u7d22\u5f15<\/li>\n<li>argsort  # \u8fd4\u56de\u6392\u5e8f\u540e\u7684\u7d22\u5f15<\/li>\n<li>max<\/li>\n<li>min<\/li>\n<li>ptp<\/li>\n<li>searchsorted<\/li>\n<li>sort<\/li>\n<\/ul>\n<h3>\u8fd0\u7b97<\/h3>\n<ul>\n<li>choose<\/li>\n<li>compress<\/li>\n<li>cumprod<\/li>\n<li>cumsum<\/li>\n<li>inner<\/li>\n<li>ndarray.fill<\/li>\n<li>imag<\/li>\n<li>prod<\/li>\n<li>put<\/li>\n<li>putmask<\/li>\n<li>real<\/li>\n<li>sum<\/li>\n<\/ul>\n<h3>\u57fa\u672c\u7edf\u8ba1<\/h3>\n<ul>\n<li>cov<\/li>\n<li>mean<\/li>\n<li>std<\/li>\n<li>var<\/li>\n<\/ul>\n<h3>\u7ebf\u6027\u4ee3\u6570<\/h3>\n<ul>\n<li>cross<\/li>\n<li>dot<\/li>\n<li>outer<\/li>\n<li>linalg<\/li>\n<li>svd<\/li>\n<li>vdot<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u7b80\u4ecb NumPy\u7cfb\u7edf\u662fPython\u7684\u4e00\u79cd\u5f00\u6e90\u7684\u6570\u503c\u8ba1\u7b97\u6269\u5c55\u3002\u8fd9\u79cd\u5de5\u5177\u53ef\u7528\u6765\u5b58\u50a8\u548c\u5904\u7406\u5927\u578b\u77e9\u9635\u3002 \u53c2\u8003\uff1ahttp [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[527],"tags":[528],"class_list":["post-2092","post","type-post","status-publish","format-standard","hentry","category-ai","tag-numpy"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/2092","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2092"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/2092\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}