{"id":1151477,"date":"2025-01-13T17:14:04","date_gmt":"2025-01-13T09:14:04","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1151477.html"},"modified":"2025-01-13T17:14:06","modified_gmt":"2025-01-13T09:14:06","slug":"python%e4%b8%ad%e5%a6%82%e4%bd%95%e8%a1%a8%e7%a4%ba%e4%b9%98%e6%b3%95","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1151477.html","title":{"rendered":"python\u4e2d\u5982\u4f55\u8868\u793a\u4e58\u6cd5"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25181701\/c136fcef-aa11-4718-8023-752f886afc17.webp\" alt=\"python\u4e2d\u5982\u4f55\u8868\u793a\u4e58\u6cd5\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\uff0c\u4e58\u6cd5\u7684\u8868\u793a\u65b9\u6cd5\u662f\u4f7f\u7528\u661f\u53f7\uff08*\uff09\u7b26\u53f7\u3001\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u51fd\u6570\u3001\u53ef\u4ee5\u4f7f\u7528Numpy\u5e93\u3001\u8fd8\u53ef\u4ee5\u4f7f\u7528\u9762\u5411\u5bf9\u8c61\u7684\u65b9\u6cd5<\/strong>\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u5c06\u8be6\u7ec6\u63cf\u8ff0\u5176\u4e2d\u7684\u4e00\u79cd\u65b9\u6cd5\uff1a\u4f7f\u7528Numpy\u5e93\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\u3002<\/p>\n<\/p>\n<p><h3>\u4f7f\u7528Numpy\u5e93\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>Numpy\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u6570\u503c\u8ba1\u7b97\u5e93\uff0c\u5b83\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u6570\u7ec4\u548c\u77e9\u9635\u8fd0\u7b97\u529f\u80fd\u3002\u5728\u8fdb\u884c\u5927\u89c4\u6a21\u6570\u503c\u8ba1\u7b97\u65f6\uff0cNumpy\u6bd4\u7eafPython\u4ee3\u7801\u8981\u5feb\u5f97\u591a\u3002\u4e3a\u4e86\u4f7f\u7528Numpy\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5\u5e76\u5bfc\u5165Numpy\u5e93\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<h2><strong>\u521b\u5efa\u4e24\u4e2a\u6570\u7ec4<\/strong><\/h2>\n<p>array1 = np.array([1, 2, 3])<\/p>\n<p>array2 = np.array([4, 5, 6])<\/p>\n<h2><strong>\u5143\u7d20\u7ea7\u522b\u7684\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result = array1 * array2<\/p>\n<p>print(result)  # \u8f93\u51fa: [ 4 10 18]<\/p>\n<h2><strong>\u77e9\u9635\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>matrix1 = np.array([[1, 2], [3, 4]])<\/p>\n<p>matrix2 = np.array([[5, 6], [7, 8]])<\/p>\n<p>result_matrix = np.dot(matrix1, matrix2)<\/p>\n<p>print(result_matrix)  # \u8f93\u51fa: [[19 22]<\/p>\n<p>                      #       [43 50]]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Numpy\u4e0d\u4ec5\u80fd\u591f\u8fdb\u884c\u7b80\u5355\u7684\u5143\u7d20\u7ea7\u522b\u7684\u4e58\u6cd5\u8fd0\u7b97\uff0c\u8fd8\u53ef\u4ee5\u8fdb\u884c\u590d\u6742\u7684\u77e9\u9635\u4e58\u6cd5\u8fd0\u7b97\uff0c\u6781\u5927\u5730\u63d0\u9ad8\u4e86\u8ba1\u7b97\u6548\u7387\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528\u661f\u53f7\uff08*\uff09\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u6700\u76f4\u63a5\u7684\u8868\u793a\u4e58\u6cd5\u7684\u65b9\u6cd5\u5c31\u662f\u4f7f\u7528\u661f\u53f7\uff08*\uff09\u7b26\u53f7\u3002\u661f\u53f7\u65e2\u53ef\u4ee5\u7528\u4e8e\u6570\u5b57\u4e4b\u95f4\u7684\u4e58\u6cd5\uff0c\u4e5f\u53ef\u4ee5\u7528\u4e8e\u53d8\u91cf\u4e4b\u95f4\u7684\u4e58\u6cd5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u6570\u5b57\u4e4b\u95f4\u7684\u4e58\u6cd5<\/p>\n<p>a = 5<\/p>\n<p>b = 3<\/p>\n<p>c = a * b<\/p>\n<p>print(c)  # \u8f93\u51fa: 15<\/p>\n<h2><strong>\u53d8\u91cf\u4e4b\u95f4\u7684\u4e58\u6cd5<\/strong><\/h2>\n<p>x = 10<\/p>\n<p>y = 2<\/p>\n<p>z = x * y<\/p>\n<p>print(z)  # \u8f93\u51fa: 20<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u661f\u53f7\u8fd0\u7b97\u7b26\u975e\u5e38\u76f4\u89c2\u548c\u6613\u4e8e\u4f7f\u7528\uff0c\u662fPython\u4e2d\u6700\u5e38\u7528\u7684\u4e58\u6cd5\u8868\u793a\u65b9\u5f0f\u4e4b\u4e00\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528\u5185\u7f6e\u51fd\u6570\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>\u9664\u4e86\u76f4\u63a5\u4f7f\u7528\u661f\u53f7\uff08*\uff09\u7b26\u53f7\uff0cPython\u8fd8\u63d0\u4f9b\u4e86\u5185\u7f6e\u51fd\u6570<code>mul<\/code>\u6765\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\u3002<code>mul<\/code>\u51fd\u6570\u4f4d\u4e8e<code>operator<\/code>\u6a21\u5757\u4e2d\uff0c\u9700\u8981\u5148\u5bfc\u5165\u6a21\u5757\u624d\u80fd\u4f7f\u7528\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import operator<\/p>\n<h2><strong>\u4f7f\u7528mul\u51fd\u6570\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>a = 7<\/p>\n<p>b = 6<\/p>\n<p>result = operator.mul(a, b)<\/p>\n<p>print(result)  # \u8f93\u51fa: 42<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><code>mul<\/code>\u51fd\u6570\u53ef\u4ee5\u7528\u4e8e\u66f4\u590d\u6742\u7684\u8fd0\u7b97\u573a\u666f\uff0c\u6bd4\u5982\u5728\u9ad8\u9636\u51fd\u6570\u4e2d\u4f20\u9012\u8fd0\u7b97\u7b26\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528Numpy\u5e93\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>Numpy\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u6570\u503c\u8ba1\u7b97\u5e93\uff0c\u5b83\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u6570\u7ec4\u548c\u77e9\u9635\u8fd0\u7b97\u529f\u80fd\u3002\u5728\u8fdb\u884c\u5927\u89c4\u6a21\u6570\u503c\u8ba1\u7b97\u65f6\uff0cNumpy\u6bd4\u7eafPython\u4ee3\u7801\u8981\u5feb\u5f97\u591a\u3002\u4e3a\u4e86\u4f7f\u7528Numpy\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5\u5e76\u5bfc\u5165Numpy\u5e93\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<h2><strong>\u521b\u5efa\u4e24\u4e2a\u6570\u7ec4<\/strong><\/h2>\n<p>array1 = np.array([1, 2, 3])<\/p>\n<p>array2 = np.array([4, 5, 6])<\/p>\n<h2><strong>\u5143\u7d20\u7ea7\u522b\u7684\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result = array1 * array2<\/p>\n<p>print(result)  # \u8f93\u51fa: [ 4 10 18]<\/p>\n<h2><strong>\u77e9\u9635\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>matrix1 = np.array([[1, 2], [3, 4]])<\/p>\n<p>matrix2 = np.array([[5, 6], [7, 8]])<\/p>\n<p>result_matrix = np.dot(matrix1, matrix2)<\/p>\n<p>print(result_matrix)  # \u8f93\u51fa: [[19 22]<\/p>\n<p>                      #       [43 50]]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Numpy\u4e0d\u4ec5\u80fd\u591f\u8fdb\u884c\u7b80\u5355\u7684\u5143\u7d20\u7ea7\u522b\u7684\u4e58\u6cd5\u8fd0\u7b97\uff0c\u8fd8\u53ef\u4ee5\u8fdb\u884c\u590d\u6742\u7684\u77e9\u9635\u4e58\u6cd5\u8fd0\u7b97\uff0c\u6781\u5927\u5730\u63d0\u9ad8\u4e86\u8ba1\u7b97\u6548\u7387\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528\u9762\u5411\u5bf9\u8c61\u7684\u65b9\u6cd5\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u5b9a\u4e49\u7c7b\u548c\u65b9\u6cd5\u6765\u5b9e\u73b0\u4e58\u6cd5\u8fd0\u7b97\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u9700\u8981\u81ea\u5b9a\u4e49\u884c\u4e3a\u7684\u573a\u666f\uff0c\u6bd4\u5982\u5728\u590d\u6742\u7684\u6570\u636e\u7ed3\u6784\u4e2d\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">class Multiplier:<\/p>\n<p>    def __init__(self, value):<\/p>\n<p>        self.value = value<\/p>\n<p>    def multiply(self, other):<\/p>\n<p>        return self.value * other.value<\/p>\n<h2><strong>\u521b\u5efa\u4e24\u4e2a\u5bf9\u8c61<\/strong><\/h2>\n<p>obj1 = Multiplier(4)<\/p>\n<p>obj2 = Multiplier(5)<\/p>\n<h2><strong>\u4f7f\u7528\u81ea\u5b9a\u4e49\u65b9\u6cd5\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result = obj1.multiply(obj2)<\/p>\n<p>print(result)  # \u8f93\u51fa: 20<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u5b9a\u4e49\u7c7b\u548c\u65b9\u6cd5\uff0c\u53ef\u4ee5\u7075\u6d3b\u5730\u63a7\u5236\u4e58\u6cd5\u8fd0\u7b97\u7684\u884c\u4e3a\uff0c\u5e76\u5c06\u5176\u5d4c\u5165\u5230\u66f4\u590d\u6742\u7684\u5e94\u7528\u573a\u666f\u4e2d\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u4f7f\u7528\u5217\u8868\u63a8\u5bfc\u5f0f\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>\u5728\u5904\u7406\u5217\u8868\u548c\u6570\u7ec4\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u5217\u8868\u63a8\u5bfc\u5f0f\u6765\u8fdb\u884c\u5143\u7d20\u7ea7\u522b\u7684\u4e58\u6cd5\u8fd0\u7b97\u3002\u5217\u8868\u63a8\u5bfc\u5f0f\u662f\u4e00\u79cd\u7b80\u6d01\u7684\u8bed\u6cd5\uff0c\u9002\u7528\u4e8e\u5404\u79cd\u6570\u636e\u5904\u7406\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5b9a\u4e49\u4e24\u4e2a\u5217\u8868<\/p>\n<p>list1 = [1, 2, 3]<\/p>\n<p>list2 = [4, 5, 6]<\/p>\n<h2><strong>\u4f7f\u7528\u5217\u8868\u63a8\u5bfc\u5f0f\u8fdb\u884c\u5143\u7d20\u7ea7\u522b\u7684\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result = [a * b for a, b in zip(list1, list2)]<\/p>\n<p>print(result)  # \u8f93\u51fa: [4, 10, 18]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5217\u8868\u63a8\u5bfc\u5f0f\u4e0d\u4ec5\u7b80\u6d01\u660e\u4e86\uff0c\u8fd8\u5177\u6709\u8f83\u9ad8\u7684\u6267\u884c\u6548\u7387\uff0c\u9002\u5408\u7528\u4e8e\u6570\u636e\u5904\u7406\u548c\u5206\u6790\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u4f7f\u7528map\u51fd\u6570\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p><code>map<\/code>\u51fd\u6570\u662fPython\u5185\u7f6e\u7684\u9ad8\u9636\u51fd\u6570\u4e4b\u4e00\uff0c\u53ef\u4ee5\u7528\u4e8e\u5c06\u4e00\u4e2a\u51fd\u6570\u5e94\u7528\u5230\u4e00\u4e2a\u6216\u591a\u4e2a\u5e8f\u5217\u7684\u6bcf\u4e2a\u5143\u7d20\u4e0a\u3002\u5728\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\u65f6\uff0c\u53ef\u4ee5\u7ed3\u5408<code>lambda<\/code>\u51fd\u6570\u4f7f\u7528<code>map<\/code>\u51fd\u6570\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5b9a\u4e49\u4e24\u4e2a\u5217\u8868<\/p>\n<p>list1 = [2, 4, 6]<\/p>\n<p>list2 = [3, 5, 7]<\/p>\n<h2><strong>\u4f7f\u7528map\u51fd\u6570\u8fdb\u884c\u5143\u7d20\u7ea7\u522b\u7684\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result = list(map(lambda x, y: x * y, list1, list2))<\/p>\n<p>print(result)  # \u8f93\u51fa: [6, 20, 42]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><code>map<\/code>\u51fd\u6570\u9002\u5408\u7528\u4e8e\u9700\u8981\u5c06\u76f8\u540c\u64cd\u4f5c\u5e94\u7528\u5230\u591a\u4e2a\u5e8f\u5217\u5143\u7d20\u4e0a\u7684\u573a\u666f\uff0c\u5177\u6709\u8f83\u9ad8\u7684\u7075\u6d3b\u6027\u548c\u53ef\u8bfb\u6027\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u4f7f\u7528\u5faa\u73af\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u5faa\u73af\u6765\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\u3002\u5faa\u73af\u53ef\u4ee5\u7075\u6d3b\u5730\u63a7\u5236\u4e58\u6cd5\u8fd0\u7b97\u7684\u903b\u8f91\uff0c\u5e76\u9002\u7528\u4e8e\u66f4\u590d\u6742\u7684\u5e94\u7528\u573a\u666f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5b9a\u4e49\u4e24\u4e2a\u5217\u8868<\/p>\n<p>list1 = [1, 3, 5]<\/p>\n<p>list2 = [2, 4, 6]<\/p>\n<h2><strong>\u4f7f\u7528\u5faa\u73af\u8fdb\u884c\u5143\u7d20\u7ea7\u522b\u7684\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result = []<\/p>\n<p>for a, b in zip(list1, list2):<\/p>\n<p>    result.append(a * b)<\/p>\n<p>print(result)  # \u8f93\u51fa: [2, 12, 30]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5faa\u73af\u867d\u7136\u4ee3\u7801\u8f83\u4e3a\u5197\u957f\uff0c\u4f46\u5728\u9700\u8981\u590d\u6742\u903b\u8f91\u63a7\u5236\u7684\u573a\u666f\u4e2d\u5177\u6709\u4e0d\u53ef\u66ff\u4ee3\u7684\u4f18\u52bf\u3002<\/p>\n<\/p>\n<p><h3>\u516b\u3001\u4f7f\u7528\u5217\u8868\u5185\u7684\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u5217\u8868\u7684\u5185\u7f6e\u65b9\u6cd5\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\u3002\u5217\u8868\u7684\u5185\u7f6e\u65b9\u6cd5<code>__mul__<\/code>\u53ef\u4ee5\u7528\u4e8e\u5b9e\u73b0\u5143\u7d20\u7ea7\u522b\u7684\u4e58\u6cd5\u8fd0\u7b97\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5b9a\u4e49\u4e24\u4e2a\u5217\u8868<\/p>\n<p>list1 = [1, 2, 3]<\/p>\n<p>list2 = [4, 5, 6]<\/p>\n<h2><strong>\u4f7f\u7528\u5217\u8868\u7684\u5185\u7f6e\u65b9\u6cd5\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result = list(map(list1.__mul__, list2))<\/p>\n<p>print(result)  # \u8f93\u51fa: [4, 10, 18]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5217\u8868\u5185\u7f6e\u65b9\u6cd5\u7684\u4f7f\u7528\u53ef\u4ee5\u7b80\u5316\u4ee3\u7801\uff0c\u5e76\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<\/p>\n<p><h3>\u4e5d\u3001\u4f7f\u7528\u6570\u7ec4\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>\u5728\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u7684\u6570\u7ec4\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\u3002\u6570\u7ec4\u5177\u6709\u9ad8\u6548\u7684\u5b58\u50a8\u548c\u8ba1\u7b97\u80fd\u529b\uff0c\u9002\u5408\u7528\u4e8e\u79d1\u5b66\u8ba1\u7b97\u548c\u6570\u636e\u5206\u6790\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from array import array<\/p>\n<h2><strong>\u5b9a\u4e49\u4e24\u4e2a\u6570\u7ec4<\/strong><\/h2>\n<p>array1 = array(&#39;i&#39;, [1, 2, 3])<\/p>\n<p>array2 = array(&#39;i&#39;, [4, 5, 6])<\/p>\n<h2><strong>\u4f7f\u7528\u5faa\u73af\u8fdb\u884c\u5143\u7d20\u7ea7\u522b\u7684\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result = array(&#39;i&#39;, (a * b for a, b in zip(array1, array2)))<\/p>\n<p>print(result)  # \u8f93\u51fa: array(&#39;i&#39;, [4, 10, 18])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6570\u7ec4\u4e0d\u4ec5\u5177\u6709\u9ad8\u6548\u7684\u8ba1\u7b97\u80fd\u529b\uff0c\u8fd8\u80fd\u591f\u8282\u7701\u5185\u5b58\u7a7a\u95f4\uff0c\u662f\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u7684\u7406\u60f3\u9009\u62e9\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u3001\u4f7f\u7528Pandas\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>Pandas\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u6570\u636e\u5904\u7406\u548c\u5206\u6790\u5e93\uff0c\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u6570\u636e\u7ed3\u6784\u548c\u6570\u636e\u64cd\u4f5c\u529f\u80fd\u3002\u5728\u8fdb\u884c\u6570\u636e\u5206\u6790\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528Pandas\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<h2><strong>\u521b\u5efa\u4e24\u4e2aSeries<\/strong><\/h2>\n<p>series1 = pd.Series([1, 2, 3])<\/p>\n<p>series2 = pd.Series([4, 5, 6])<\/p>\n<h2><strong>\u4f7f\u7528Pandas\u8fdb\u884c\u5143\u7d20\u7ea7\u522b\u7684\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result = series1 * series2<\/p>\n<p>print(result)  # \u8f93\u51fa:<\/p>\n<p>               # 0     4<\/p>\n<p>               # 1    10<\/p>\n<p>               # 2    18<\/p>\n<p>               # dtype: int64<\/p>\n<h2><strong>\u521b\u5efa\u4e24\u4e2aDataFrame<\/strong><\/h2>\n<p>df1 = pd.DataFrame([[1, 2], [3, 4]], columns=[&#39;A&#39;, &#39;B&#39;])<\/p>\n<p>df2 = pd.DataFrame([[5, 6], [7, 8]], columns=[&#39;A&#39;, &#39;B&#39;])<\/p>\n<h2><strong>\u4f7f\u7528Pandas\u8fdb\u884c\u77e9\u9635\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result_df = df1.dot(df2.T)<\/p>\n<p>print(result_df)  # \u8f93\u51fa:<\/p>\n<p>                  #    0   1<\/p>\n<p>                  # 0  17  23<\/p>\n<p>                  # 1  39  53<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Pandas\u4e0d\u4ec5\u80fd\u591f\u8fdb\u884c\u7b80\u5355\u7684\u5143\u7d20\u7ea7\u522b\u4e58\u6cd5\u8fd0\u7b97\uff0c\u8fd8\u53ef\u4ee5\u8fdb\u884c\u590d\u6742\u7684\u77e9\u9635\u4e58\u6cd5\u8fd0\u7b97\uff0c\u9002\u5408\u7528\u4e8e\u6570\u636e\u5904\u7406\u548c\u5206\u6790\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u4e00\u3001\u4f7f\u7528SymPy\u8fdb\u884c\u7b26\u53f7\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>SymPy\u662f\u4e00\u4e2a\u7528\u4e8e\u7b26\u53f7\u8ba1\u7b97\u7684Python\u5e93\uff0c\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u7b26\u53f7\u8ba1\u7b97\u529f\u80fd\u3002\u5728\u8fdb\u884c\u7b26\u53f7\u8ba1\u7b97\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528SymPy\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import sympy as sp<\/p>\n<h2><strong>\u5b9a\u4e49\u7b26\u53f7\u53d8\u91cf<\/strong><\/h2>\n<p>x, y = sp.symbols(&#39;x y&#39;)<\/p>\n<h2><strong>\u4f7f\u7528SymPy\u8fdb\u884c\u7b26\u53f7\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result = x * y<\/p>\n<p>print(result)  # \u8f93\u51fa: x*y<\/p>\n<h2><strong>\u8fdb\u884c\u7b26\u53f7\u5c55\u5f00<\/strong><\/h2>\n<p>expanded_result = sp.expand((x + y) * (x - y))<\/p>\n<p>print(expanded_result)  # \u8f93\u51fa: x&lt;strong&gt;2 - y&lt;\/strong&gt;2<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>SymPy\u9002\u7528\u4e8e\u9700\u8981\u8fdb\u884c\u7b26\u53f7\u8ba1\u7b97\u7684\u573a\u666f\uff0c\u6bd4\u5982\u4ee3\u6570\u8fd0\u7b97\u3001\u5fae\u79ef\u5206\u7b49\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u4e8c\u3001\u4f7f\u7528Scipy\u8fdb\u884c\u79d1\u5b66\u8ba1\u7b97\u4e2d\u7684\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>Scipy\u662f\u4e00\u4e2a\u7528\u4e8e\u79d1\u5b66\u8ba1\u7b97\u7684Python\u5e93\uff0c\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u79d1\u5b66\u8ba1\u7b97\u529f\u80fd\u3002\u5728\u8fdb\u884c\u79d1\u5b66\u8ba1\u7b97\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528Scipy\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from scipy.sparse import csr_matrix<\/p>\n<h2><strong>\u521b\u5efa\u4e24\u4e2a\u7a00\u758f\u77e9\u9635<\/strong><\/h2>\n<p>matrix1 = csr_matrix([[1, 0], [0, 1]])<\/p>\n<p>matrix2 = csr_matrix([[2, 3], [4, 5]])<\/p>\n<h2><strong>\u4f7f\u7528Scipy\u8fdb\u884c\u7a00\u758f\u77e9\u9635\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result_matrix = matrix1.dot(matrix2)<\/p>\n<p>print(result_matrix.toarray())  # \u8f93\u51fa: [[2 3]<\/p>\n<p>                                #       [4 5]]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Scipy\u9002\u7528\u4e8e\u9700\u8981\u8fdb\u884c\u79d1\u5b66\u8ba1\u7b97\u7684\u573a\u666f\uff0c\u6bd4\u5982\u7a00\u758f\u77e9\u9635\u8fd0\u7b97\u3001\u6570\u503c\u79ef\u5206\u7b49\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u4e09\u3001\u4f7f\u7528TensorFlow\u8fdb\u884c\u6df1\u5ea6\u5b66\u4e60\u4e2d\u7684\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>TensorFlow\u662f\u4e00\u4e2a\u7528\u4e8e\u6df1\u5ea6\u5b66\u4e60\u7684\u5f00\u6e90\u6846\u67b6\uff0c\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u5f20\u91cf\u8fd0\u7b97\u529f\u80fd\u3002\u5728\u8fdb\u884c\u6df1\u5ea6\u5b66\u4e60\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528TensorFlow\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import tensorflow as tf<\/p>\n<h2><strong>\u521b\u5efa\u4e24\u4e2a\u5f20\u91cf<\/strong><\/h2>\n<p>tensor1 = tf.constant([1, 2, 3])<\/p>\n<p>tensor2 = tf.constant([4, 5, 6])<\/p>\n<h2><strong>\u4f7f\u7528TensorFlow\u8fdb\u884c\u5143\u7d20\u7ea7\u522b\u7684\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result = tf.multiply(tensor1, tensor2)<\/p>\n<p>print(result)  # \u8f93\u51fa: tf.Tensor([ 4 10 18], shape=(3,), dtype=int32)<\/p>\n<h2><strong>\u521b\u5efa\u4e24\u4e2a\u77e9\u9635<\/strong><\/h2>\n<p>matrix1 = tf.constant([[1, 2], [3, 4]])<\/p>\n<p>matrix2 = tf.constant([[5, 6], [7, 8]])<\/p>\n<h2><strong>\u4f7f\u7528TensorFlow\u8fdb\u884c\u77e9\u9635\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result_matrix = tf.matmul(matrix1, matrix2)<\/p>\n<p>print(result_matrix)  # \u8f93\u51fa:<\/p>\n<p>                      # tf.Tensor(<\/p>\n<p>                      # [[19 22]<\/p>\n<p>                      #  [43 50]], shape=(2, 2), dtype=int32)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>TensorFlow\u9002\u7528\u4e8e\u9700\u8981\u8fdb\u884c\u6df1\u5ea6\u5b66\u4e60\u7684\u573a\u666f\uff0c\u6bd4\u5982\u795e\u7ecf\u7f51\u7edc\u8bad\u7ec3\u548c\u63a8\u7406\u7b49\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u56db\u3001\u4f7f\u7528PyTorch\u8fdb\u884c\u6df1\u5ea6\u5b66\u4e60\u4e2d\u7684\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>PyTorch\u662f\u53e6\u4e00\u4e2a\u7528\u4e8e\u6df1\u5ea6\u5b66\u4e60\u7684\u5f00\u6e90\u6846\u67b6\uff0c\u63d0\u4f9b\u4e86\u7075\u6d3b\u7684\u5f20\u91cf\u8fd0\u7b97\u529f\u80fd\u3002\u5728\u8fdb\u884c\u6df1\u5ea6\u5b66\u4e60\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528PyTorch\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import torch<\/p>\n<h2><strong>\u521b\u5efa\u4e24\u4e2a\u5f20\u91cf<\/strong><\/h2>\n<p>tensor1 = torch.tensor([1, 2, 3])<\/p>\n<p>tensor2 = torch.tensor([4, 5, 6])<\/p>\n<h2><strong>\u4f7f\u7528PyTorch\u8fdb\u884c\u5143\u7d20\u7ea7\u522b\u7684\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result = torch.mul(tensor1, tensor2)<\/p>\n<p>print(result)  # \u8f93\u51fa: tensor([ 4, 10, 18])<\/p>\n<h2><strong>\u521b\u5efa\u4e24\u4e2a\u77e9\u9635<\/strong><\/h2>\n<p>matrix1 = torch.tensor([[1, 2], [3, 4]])<\/p>\n<p>matrix2 = torch.tensor([[5, 6], [7, 8]])<\/p>\n<h2><strong>\u4f7f\u7528PyTorch\u8fdb\u884c\u77e9\u9635\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result_matrix = torch.matmul(matrix1, matrix2)<\/p>\n<p>print(result_matrix)  # \u8f93\u51fa:<\/p>\n<p>                      # tensor([[19, 22],<\/p>\n<p>                      #         [43, 50]])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>PyTorch\u9002\u7528\u4e8e\u9700\u8981\u8fdb\u884c\u6df1\u5ea6\u5b66\u4e60\u7684\u573a\u666f\uff0c\u6bd4\u5982\u795e\u7ecf\u7f51\u7edc\u8bad\u7ec3\u548c\u63a8\u7406\u7b49\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u4e94\u3001\u4f7f\u7528Cython\u8fdb\u884c\u9ad8\u6548\u7684\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>Cython\u662f\u4e00\u4e2a\u7528\u4e8e\u4f18\u5316Python\u4ee3\u7801\u7684\u7f16\u8bd1\u5668\uff0c\u53ef\u4ee5\u5c06Python\u4ee3\u7801\u7f16\u8bd1\u6210C\u4ee3\u7801\u4ee5\u63d0\u9ad8\u6027\u80fd\u3002\u5728\u9700\u8981\u9ad8\u6548\u4e58\u6cd5\u8fd0\u7b97\u7684\u573a\u666f\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528Cython\u8fdb\u884c\u4f18\u5316\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-cython\"># \u4f7f\u7528Cython\u8fdb\u884c\u9ad8\u6548\u7684\u4e58\u6cd5\u8fd0\u7b97<\/p>\n<p>def multiply(int a, int b):<\/p>\n<p>    return a * b<\/p>\n<h2><strong>\u7f16\u8bd1Cython\u4ee3\u7801<\/strong><\/h2>\n<p>%load_ext Cython<\/p>\n<p>%%cython<\/p>\n<p>cpdef int multiply(int a, int b):<\/p>\n<p>    return a * b<\/p>\n<h2><strong>\u8c03\u7528Cython\u51fd\u6570<\/strong><\/h2>\n<p>result = multiply(4, 5)<\/p>\n<p>print(result)  # \u8f93\u51fa: 20<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Cython\u9002\u7528\u4e8e\u9700\u8981\u8fdb\u884c\u6027\u80fd\u4f18\u5316\u7684\u573a\u666f\uff0c\u6bd4\u5982\u6570\u503c\u8ba1\u7b97\u548c\u6570\u636e\u5904\u7406\u7b49\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u516d\u3001\u4f7f\u7528Numba\u8fdb\u884c\u9ad8\u6548\u7684\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>Numba\u662f\u4e00\u4e2a\u7528\u4e8e\u52a0\u901fPython\u4ee3\u7801\u7684JIT\u7f16\u8bd1\u5668\uff0c\u53ef\u4ee5\u5c06Python\u4ee3\u7801\u7f16\u8bd1\u6210\u673a\u5668\u7801\u4ee5\u63d0\u9ad8\u6027\u80fd\u3002\u5728\u9700\u8981\u9ad8\u6548\u4e58\u6cd5\u8fd0\u7b97\u7684\u573a\u666f\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528Numba\u8fdb\u884c\u4f18\u5316\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from numba import jit<\/p>\n<h2><strong>\u4f7f\u7528Numba\u8fdb\u884c\u9ad8\u6548\u7684\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>@jit(nopython=True)<\/p>\n<p>def multiply(a, b):<\/p>\n<p>    return a * b<\/p>\n<h2><strong>\u8c03\u7528Numba\u51fd\u6570<\/strong><\/h2>\n<p>result = multiply(4, 5)<\/p>\n<p>print(result)  # \u8f93\u51fa: 20<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Numba\u9002\u7528\u4e8e\u9700\u8981\u8fdb\u884c\u6027\u80fd\u4f18\u5316\u7684\u573a\u666f\uff0c\u6bd4\u5982\u6570\u503c\u8ba1\u7b97\u548c\u6570\u636e\u5904\u7406\u7b49\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u4e03\u3001\u4f7f\u7528Dask\u8fdb\u884c\u5927\u89c4\u6a21\u6570\u636e\u7684\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>Dask\u662f\u4e00\u4e2a\u7528\u4e8e\u5e76\u884c\u8ba1\u7b97\u7684Python\u5e93\uff0c\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u5927\u89c4\u6a21\u6570\u636e\u5904\u7406\u529f\u80fd\u3002\u5728\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528Dask\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import dask.array as da<\/p>\n<h2><strong>\u521b\u5efa\u4e24\u4e2aDask\u6570\u7ec4<\/strong><\/h2>\n<p>array1 = da.from_array([1, 2, 3], chunks=2)<\/p>\n<p>array2 = da.from_array([4, 5, 6], chunks=2)<\/p>\n<h2><strong>\u4f7f\u7528Dask\u8fdb\u884c\u5143\u7d20\u7ea7\u522b\u7684\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result = array1 * array2<\/p>\n<p>print(result.compute())  # \u8f93\u51fa: [ 4 10 18]<\/p>\n<h2><strong>\u521b\u5efa\u4e24\u4e2aDask\u77e9\u9635<\/strong><\/h2>\n<p>matrix1 = da.from_array([[1, 2], [3, 4]], chunks=(2, 2))<\/p>\n<p>matrix2 = da.from_array([[5, 6], [7, 8]], chunks=(2, 2))<\/p>\n<h2><strong>\u4f7f\u7528Dask\u8fdb\u884c\u77e9\u9635\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result_matrix = da.dot(matrix1, matrix2)<\/p>\n<p>print(result_matrix.compute())  # \u8f93\u51fa:<\/p>\n<p>                                # [[19 22]<\/p>\n<p>                                #  [43 50]]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Dask\u9002\u7528\u4e8e\u9700\u8981\u8fdb\u884c\u5927\u89c4\u6a21\u6570\u636e\u5904\u7406\u7684\u573a\u666f\uff0c\u6bd4\u5982\u5e76\u884c\u8ba1\u7b97\u548c\u5206\u5e03\u5f0f\u8ba1\u7b97\u7b49\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u516b\u3001\u4f7f\u7528CuPy\u8fdb\u884cGPU\u4e0a\u7684\u4e58\u6cd5\u8fd0\u7b97<\/h3>\n<\/p>\n<p><p>CuPy\u662f\u4e00\u4e2a\u7528\u4e8eGPU\u52a0\u901f\u8ba1\u7b97\u7684Python\u5e93\uff0c\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684GPU\u8fd0\u7b97\u529f\u80fd\u3002\u5728\u9700\u8981\u8fdb\u884cGPU\u52a0\u901f\u8ba1\u7b97\u7684\u573a\u666f\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528CuPy\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import cupy as cp<\/p>\n<h2><strong>\u521b\u5efa\u4e24\u4e2aCuPy\u6570\u7ec4<\/strong><\/h2>\n<p>array1 = cp.array([1, 2, 3])<\/p>\n<p>array2 = cp.array([4, 5, 6])<\/p>\n<h2><strong>\u4f7f\u7528CuPy\u8fdb\u884c\u5143\u7d20\u7ea7\u522b\u7684\u4e58\u6cd5\u8fd0\u7b97<\/strong><\/h2>\n<p>result = array1 * array2<\/p>\n<p>print(result)  # \u8f93\u51fa: [ 4 10<\/p>\n<p><\/code><\/pre>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5728Python\u4e2d\u5982\u4f55\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u4e58\u6cd5\u8fd0\u7b97\u4f7f\u7528\u661f\u53f7\uff08*\uff09\u7b26\u53f7\u3002\u4f8b\u5982\uff0c\u8981\u8ba1\u7b97\u4e24\u4e2a\u6570\u5b57\u7684\u4e58\u79ef\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\uff1a<code>result = a * b<\/code>\uff0c\u5176\u4e2d<code>a<\/code>\u548c<code>b<\/code>\u662f\u8981\u76f8\u4e58\u7684\u53d8\u91cf\u3002\u8fd9\u79cd\u7b80\u5355\u7684\u8bed\u6cd5\u4f7f\u5f97\u4e58\u6cd5\u8fd0\u7b97\u76f4\u89c2\u6613\u61c2\u3002<\/p>\n<p><strong>Python\u652f\u6301\u54ea\u4e9b\u6570\u636e\u7c7b\u578b\u7684\u4e58\u6cd5\uff1f<\/strong><br \/>Python\u652f\u6301\u591a\u79cd\u6570\u636e\u7c7b\u578b\u7684\u4e58\u6cd5\u8fd0\u7b97\uff0c\u5305\u62ec\u6574\u6570\u3001\u6d6e\u70b9\u6570\u548c\u590d\u6570\u3002\u5f53\u4f60\u5c1d\u8bd5\u5c06\u8fd9\u4e9b\u4e0d\u540c\u7c7b\u578b\u7684\u6570\u8fdb\u884c\u76f8\u4e58\u65f6\uff0cPython\u4f1a\u81ea\u52a8\u5904\u7406\u6570\u636e\u7c7b\u578b\u7684\u8f6c\u6362\u3002\u4f8b\u5982\uff0c\u6574\u6570\u548c\u6d6e\u70b9\u6570\u76f8\u4e58\u4f1a\u8fd4\u56de\u6d6e\u70b9\u6570\u7ed3\u679c\u3002\u4f60\u4e5f\u53ef\u4ee5\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\uff0c\u901a\u8fc7\u91cd\u590d\u5b57\u7b26\u4e32\u7684\u65b9\u5f0f\u751f\u6210\u65b0\u7684\u5b57\u7b26\u4e32\uff0c\u5982<code>&#39;hello&#39; * 3<\/code>\u5c06\u8fd4\u56de<code>&#39;hellohellohello&#39;<\/code>\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Python\u4e2d\u5b9e\u73b0\u77e9\u9635\u7684\u4e58\u6cd5\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528NumPy\u5e93\u8fdb\u884c\u77e9\u9635\u4e58\u6cd5\u3002\u4f7f\u7528NumPy\u7684<code>dot<\/code>\u51fd\u6570\u6216\u8fd0\u7b97\u7b26<code>@<\/code>\u53ef\u4ee5\u65b9\u4fbf\u5730\u8fdb\u884c\u77e9\u9635\u76f8\u4e58\u3002\u4f8b\u5982\uff0c\u5047\u8bbe\u6709\u4e24\u4e2a\u77e9\u9635<code>A<\/code>\u548c<code>B<\/code>\uff0c\u53ef\u4ee5\u4f7f\u7528<code>numpy.dot(A, B)<\/code>\u6216<code>A @ B<\/code>\u6765\u8ba1\u7b97\u5b83\u4eec\u7684\u4e58\u79ef\u3002\u8fd9\u79cd\u65b9\u5f0f\u7279\u522b\u9002\u5408\u5904\u7406\u591a\u7ef4\u6570\u7ec4\u548c\u77e9\u9635\u8fd0\u7b97\uff0c\u6781\u5927\u5730\u63d0\u9ad8\u4e86\u8ba1\u7b97\u6548\u7387\u548c\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\uff0c\u4e58\u6cd5\u7684\u8868\u793a\u65b9\u6cd5\u662f\u4f7f\u7528\u661f\u53f7\uff08*\uff09\u7b26\u53f7\u3001\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u51fd\u6570\u3001\u53ef\u4ee5\u4f7f\u7528Numpy\u5e93\u3001\u8fd8\u53ef\u4ee5\u4f7f\u7528\u9762\u5411\u5bf9 [&hellip;]","protected":false},"author":3,"featured_media":1151483,"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\/1151477"}],"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=1151477"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1151477\/revisions"}],"predecessor-version":[{"id":1151484,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1151477\/revisions\/1151484"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1151483"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1151477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1151477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1151477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}