{"id":478240,"date":"2023-08-09T09:29:36","date_gmt":"2023-08-09T09:29:36","guid":{"rendered":""},"modified":"2023-09-05T11:16:20","modified_gmt":"2023-09-05T11:16:20","slug":"numpy","status":"publish","type":"wiki","link":"https:\/\/oneproxy.pro\/cn\/wiki\/numpy\/","title":{"rendered":"\u6570\u503c\u6a21\u62df"},"content":{"rendered":"<p>NumPy \u662f\u201cNumerical Python\u201d\u7684\u7f29\u5199\uff0c\u662f Python \u7f16\u7a0b\u8bed\u8a00\u4e2d\u7528\u4e8e\u6570\u503c\u8ba1\u7b97\u7684\u57fa\u672c\u5e93\u3002\u5b83\u652f\u6301\u5927\u578b\u591a\u7ef4\u6570\u7ec4\u548c\u77e9\u9635\uff0c\u4ee5\u53ca\u4e00\u7ec4\u53ef\u6709\u6548\u64cd\u4f5c\u8fd9\u4e9b\u6570\u7ec4\u7684\u6570\u5b66\u51fd\u6570\u3002NumPy \u662f\u4e00\u4e2a\u5f00\u6e90\u9879\u76ee\uff0c\u5df2\u6210\u4e3a\u6570\u636e\u79d1\u5b66\u3001\u673a\u5668\u5b66\u4e60\u3001\u79d1\u5b66\u7814\u7a76\u548c\u5de5\u7a0b\u7b49\u5404\u4e2a\u9886\u57df\u7684\u5173\u952e\u7ec4\u6210\u90e8\u5206\u3002\u5b83\u4e8e 2005 \u5e74\u9996\u6b21\u63a8\u51fa\uff0c\u73b0\u5df2\u6210\u4e3a Python \u751f\u6001\u7cfb\u7edf\u4e2d\u4f7f\u7528\u6700\u5e7f\u6cdb\u7684\u5e93\u4e4b\u4e00\u3002<\/p>\n<h2>NumPy \u7684\u8d77\u6e90\u5386\u53f2\u4ee5\u53ca\u9996\u6b21\u63d0\u53ca\u5b83<\/h2>\n<p>NumPy \u7684\u8bde\u751f\u6e90\u4e8e\u4eba\u4eec\u5bf9 Python \u4e2d\u66f4\u9ad8\u6548\u7684\u6570\u7ec4\u5904\u7406\u80fd\u529b\u7684\u6e34\u671b\u3002NumPy \u7684\u57fa\u7840\u7531 Jim Hugunin \u5960\u5b9a\uff0c\u4ed6\u4e8e 1995 \u5e74\u521b\u5efa\u4e86 Numeric \u5e93\u3002Numeric \u662f Python \u7684\u7b2c\u4e00\u4e2a\u6570\u7ec4\u5904\u7406\u5305\uff0c\u4e5f\u662f NumPy \u7684\u524d\u8eab\u3002<\/p>\n<p>2005 \u5e74\uff0c\u79d1\u5b66 Python \u793e\u533a\u7684\u5f00\u53d1\u4eba\u5458 Travis Oliphant \u5c06 Numeric \u548c\u53e6\u4e00\u4e2a\u540d\u4e3a\u201cnumarray\u201d\u7684\u5e93\u7684\u6700\u4f73\u529f\u80fd\u7ed3\u5408\u8d77\u6765\uff0c\u521b\u5efa\u4e86 NumPy\u3002\u8fd9\u4e2a\u65b0\u5e93\u65e8\u5728\u89e3\u51b3\u4ee5\u524d\u8f6f\u4ef6\u5305\u7684\u5c40\u9650\u6027\uff0c\u5e76\u4e3a Python \u5f00\u53d1\u4eba\u5458\u63d0\u4f9b\u5f3a\u5927\u7684\u6570\u7ec4\u64cd\u4f5c\u5de5\u5177\u96c6\u3002\u968f\u7740\u5b83\u7684\u63a8\u51fa\uff0cNumPy \u8fc5\u901f\u83b7\u5f97\u4e86\u7814\u7a76\u4eba\u5458\u3001\u5de5\u7a0b\u5e08\u548c\u6570\u636e\u79d1\u5b66\u5bb6\u7684\u6b22\u8fce\u548c\u8ba4\u53ef\u3002<\/p>\n<h2>\u5173\u4e8e NumPy \u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u6269\u5c55 NumPy \u4e3b\u9898\u3002<\/h2>\n<p>NumPy \u4e0d\u4ec5\u4ec5\u662f\u4e00\u4e2a\u6570\u7ec4\u5904\u7406\u5e93\uff1b\u5b83\u662f\u5404\u79cd\u5176\u4ed6 Python \u5e93\u7684\u9aa8\u5e72\uff0c\u5305\u62ec SciPy\u3001Pandas\u3001Matplotlib \u548c scikit-learn\u3002NumPy \u7684\u4e00\u4e9b\u4e3b\u8981\u7279\u6027\u548c\u529f\u80fd\u5305\u62ec\uff1a<\/p>\n<ol>\n<li>\n<p><strong>\u9ad8\u6548\u7684\u6570\u7ec4\u64cd\u4f5c<\/strong>\uff1aNumPy \u63d0\u4f9b\u4e86\u4e00\u7ec4\u5e7f\u6cdb\u7684\u51fd\u6570\u6765\u5bf9\u6570\u7ec4\u6267\u884c\u9010\u5143\u7d20\u8fd0\u7b97\uff0c\u4f7f\u5f97\u6570\u5b66\u8fd0\u7b97\u548c\u6570\u636e\u64cd\u4f5c\u66f4\u5feb\u3001\u66f4\u7b80\u6d01\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u591a\u7ef4\u6570\u7ec4\u652f\u6301<\/strong>\uff1aNumPy \u5141\u8bb8\u7528\u6237\u4f7f\u7528\u591a\u7ef4\u6570\u7ec4\uff0c\u4ece\u800c\u80fd\u591f\u6709\u6548\u5904\u7406\u5927\u578b\u6570\u636e\u96c6\u548c\u590d\u6742\u7684\u6570\u5b66\u8ba1\u7b97\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u5e7f\u64ad<\/strong>\uff1aNumPy \u7684\u5e7f\u64ad\u529f\u80fd\u652f\u6301\u4e0d\u540c\u5f62\u72b6\u7684\u6570\u7ec4\u4e4b\u95f4\u7684\u64cd\u4f5c\uff0c\u51cf\u5c11\u4e86\u5bf9\u663e\u5f0f\u5faa\u73af\u7684\u9700\u8981\u5e76\u63d0\u9ad8\u4e86\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u5b66\u51fd\u6570<\/strong>\uff1aNumPy \u63d0\u4f9b\u5e7f\u6cdb\u7684\u6570\u5b66\u51fd\u6570\uff0c\u5305\u62ec\u57fa\u672c\u7b97\u672f\u3001\u4e09\u89d2\u3001\u5bf9\u6570\u3001\u7edf\u8ba1\u548c\u7ebf\u6027\u4ee3\u6570\u8fd0\u7b97\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u7ec4\u7d22\u5f15\u548c\u5207\u7247<\/strong>\uff1aNumPy \u652f\u6301\u9ad8\u7ea7\u7d22\u5f15\u6280\u672f\uff0c\u4f7f\u7528\u6237\u80fd\u591f\u5feb\u901f\u8bbf\u95ee\u548c\u4fee\u6539\u6570\u7ec4\u7684\u7279\u5b9a\u5143\u7d20\u6216\u5b50\u96c6\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u4e0e C\/C++ \u548c Fortran \u96c6\u6210<\/strong>\uff1aNumPy \u65e8\u5728\u4e0e\u7528 C\u3001C++ \u548c Fortran \u7f16\u5199\u7684\u4ee3\u7801\u65e0\u7f1d\u96c6\u6210\uff0c\u4f7f\u7528\u6237\u80fd\u591f\u5c06 Python \u7684\u6613\u7528\u6027\u4e0e\u4f4e\u7ea7\u8bed\u8a00\u7684\u6027\u80fd\u7ed3\u5408\u8d77\u6765\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u6027\u80fd\u4f18\u5316<\/strong>\uff1aNumPy \u7684\u6838\u5fc3\u662f\u7528 C \u5b9e\u73b0\u7684\uff0c\u5141\u8bb8\u9ad8\u6548\u7684\u5185\u5b58\u7ba1\u7406\uff0c\u4ece\u800c\u7f29\u77ed\u6570\u503c\u8ba1\u7b97\u7684\u6267\u884c\u65f6\u95f4\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u4e92\u64cd\u4f5c\u6027<\/strong>\uff1aNumPy\u53ef\u4ee5\u4e0ePython\u4e2d\u7684\u5176\u4ed6\u6570\u636e\u7ed3\u6784\u65e0\u7f1d\u4ea4\u4e92\uff0c\u5e76\u652f\u6301\u4e0e\u5916\u90e8\u5e93\u548c\u6587\u4ef6\u683c\u5f0f\u8fdb\u884c\u6570\u636e\u4ea4\u6362\u3002<\/p>\n<\/li>\n<\/ol>\n<h2>NumPy \u7684\u5185\u90e8\u7ed3\u6784\u3002NumPy \u7684\u5de5\u4f5c\u539f\u7406\u3002<\/h2>\n<p>NumPy \u7684\u5185\u90e8\u7ed3\u6784\u56f4\u7ed5\u5176\u6838\u5fc3\u6570\u636e\u7ed3\u6784\uff1andarray\uff08n \u7ef4\u6570\u7ec4\uff09\u3002ndarray \u662f\u4e00\u4e2a\u540c\u8d28\u6570\u7ec4\uff0c\u7528\u4e8e\u5b58\u50a8\u76f8\u540c\u6570\u636e\u7c7b\u578b\u7684\u5143\u7d20\u3002\u5b83\u662f\u6240\u6709 NumPy \u64cd\u4f5c\u7684\u57fa\u7840\uff0c\u4e0e Python \u5217\u8868\u76f8\u6bd4\u5177\u6709\u663e\u8457\u4f18\u52bf\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u8fde\u7eed\u7684\u5185\u5b58\u5757\uff0c\u7528\u4e8e\u5feb\u901f\u8bbf\u95ee\u548c\u64cd\u4f5c<\/li>\n<li>\u9ad8\u6548\u5e7f\u64ad\u5143\u7d20\u7ea7\u64cd\u4f5c<\/li>\n<li>\u77e2\u91cf\u5316\u64cd\u4f5c\uff0c\u6d88\u9664\u4e86\u663e\u5f0f\u5faa\u73af\u7684\u9700\u8981<\/li>\n<\/ul>\n<p>\u5728\u5e95\u5c42\uff0cNumPy \u4f7f\u7528 C \u548c C++ \u4ee3\u7801\u6765\u5904\u7406\u6570\u7ec4\u5904\u7406\u7684\u5173\u952e\u90e8\u5206\uff0c\u4e0e\u7eaf Python \u5b9e\u73b0\u76f8\u6bd4\uff0c\u901f\u5ea6\u660e\u663e\u66f4\u5feb\u3002NumPy \u8fd8\u5229\u7528 BLAS\uff08\u57fa\u672c\u7ebf\u6027\u4ee3\u6570\u5b50\u7a0b\u5e8f\uff09\u548c LAPACK\uff08\u7ebf\u6027\u4ee3\u6570\u5305\uff09\u5e93\u6765\u4f18\u5316\u7ebf\u6027\u4ee3\u6570\u8ba1\u7b97\u3002<\/p>\n<p>NumPy \u5bf9\u6570\u7ec4\u548c\u64cd\u4f5c\u7684\u5b9e\u73b0\u7ecf\u8fc7\u7cbe\u5fc3\u4f18\u5316\uff0c\u6027\u80fd\u51fa\u8272\uff0c\u662f\u5904\u7406\u5927\u578b\u6570\u636e\u96c6\u548c\u8ba1\u7b97\u5bc6\u96c6\u578b\u4efb\u52a1\u7684\u7406\u60f3\u9009\u62e9\u3002<\/p>\n<h2>NumPy \u7684\u5173\u952e\u7279\u6027\u5206\u6790\u3002<\/h2>\n<p>NumPy \u7684\u4e3b\u8981\u529f\u80fd\u4f7f\u5176\u6210\u4e3a\u5404\u79cd\u79d1\u5b66\u548c\u5de5\u7a0b\u5e94\u7528\u4e0d\u53ef\u6216\u7f3a\u7684\u5de5\u5177\u3002\u8ba9\u6211\u4eec\u6df1\u5165\u63a2\u8ba8\u4e00\u4e0b\u5b83\u7684\u4e00\u4e9b\u6700\u663e\u8457\u7684\u4f18\u52bf\uff1a<\/p>\n<ol>\n<li>\n<p><strong>\u6548\u7387<\/strong>\uff1aNumPy \u7684\u6570\u7ec4\u64cd\u4f5c\u7ecf\u8fc7\u9ad8\u5ea6\u4f18\u5316\uff0c\u4e0e\u4f20\u7edf\u7684 Python \u5217\u8868\u548c\u5faa\u73af\u76f8\u6bd4\uff0c\u6267\u884c\u65f6\u95f4\u66f4\u5feb\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u9635\u5217\u5e7f\u64ad<\/strong>\uff1a\u5e7f\u64ad\u5141\u8bb8 NumPy \u5bf9\u5177\u6709\u4e0d\u540c\u5f62\u72b6\u7684\u6570\u7ec4\u6267\u884c\u9010\u5143\u7d20\u64cd\u4f5c\uff0c\u4ece\u800c\u4ea7\u751f\u7b80\u6d01\u4e14\u53ef\u8bfb\u7684\u4ee3\u7801\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u5185\u5b58\u6548\u7387<\/strong>\uff1aNumPy \u6570\u7ec4\u4f7f\u7528\u8fde\u7eed\u7684\u5185\u5b58\u5757\uff0c\u4ece\u800c\u51cf\u5c11\u5f00\u9500\u5e76\u786e\u4fdd\u9ad8\u6548\u7684\u5185\u5b58\u5229\u7528\u7387\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u4e92\u64cd\u4f5c\u6027<\/strong>\uff1aNumPy\u53ef\u4ee5\u4e0ePython\u4e2d\u7684\u5176\u4ed6\u5e93\u548c\u6570\u636e\u7ed3\u6784\u65e0\u7f1d\u96c6\u6210\uff0c\u4ece\u800c\u5b9e\u73b0\u4e30\u5bcc\u7684\u79d1\u5b66\u8ba1\u7b97\u5de5\u5177\u751f\u6001\u7cfb\u7edf\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u5411\u91cf\u5316\u64cd\u4f5c<\/strong>\uff1aNumPy \u9f13\u52b1\u77e2\u91cf\u5316\u64cd\u4f5c\uff0c\u8fd9\u6837\u5c31\u4e0d\u9700\u8981\u663e\u5f0f\u5faa\u73af\uff0c\u4ece\u800c\u4ea7\u751f\u66f4\u7b80\u6d01\u3001\u66f4\u6613\u4e8e\u7ef4\u62a4\u7684\u4ee3\u7801\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u5b66\u51fd\u6570<\/strong>\uff1aNumPy \u7684\u4e30\u5bcc\u6570\u5b66\u51fd\u6570\u96c6\u5408\u7b80\u5316\u4e86\u590d\u6742\u7684\u8ba1\u7b97\uff0c\u7279\u522b\u662f\u5728\u7ebf\u6027\u4ee3\u6570\u548c\u7edf\u8ba1\u5b66\u4e2d\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u636e\u5206\u6790\u4e0e\u53ef\u89c6\u5316<\/strong>\uff1aNumPy \u5728\u6570\u636e\u5206\u6790\u548c\u53ef\u89c6\u5316\u4e2d\u8d77\u7740\u5173\u952e\u4f5c\u7528\uff0c\u4f7f\u5f97\u63a2\u7d22\u548c\u5206\u6790\u6570\u636e\u96c6\u53d8\u5f97\u66f4\u52a0\u5bb9\u6613\u3002<\/p>\n<\/li>\n<\/ol>\n<h2>NumPy \u6570\u7ec4\u7684\u7c7b\u578b<\/h2>\n<p>NumPy \u63d0\u4f9b\u4e86\u5404\u79cd\u7c7b\u578b\u7684\u6570\u7ec4\u6765\u9002\u5e94\u4e0d\u540c\u7684\u6570\u636e\u9700\u6c42\u3002\u6700\u5e38\u7528\u7684\u7c7b\u578b\u662f\uff1a<\/p>\n<ol>\n<li>\n<p><strong>\u6570\u7ec4<\/strong>\uff1a\u4e3b\u8981\u6570\u7ec4\u7c7b\u578b\uff0c\u80fd\u591f\u5728\u591a\u4e2a\u7ef4\u5ea6\u4e2d\u4fdd\u5b58\u76f8\u540c\u6570\u636e\u7c7b\u578b\u7684\u5143\u7d20\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u7ed3\u6784\u5316\u6570\u7ec4<\/strong>\uff1a\u53ef\u4ee5\u4fdd\u5b58\u5f02\u6784\u6570\u636e\u7c7b\u578b\u7684\u6570\u7ec4\uff0c\u7ed3\u6784\u5316\u6570\u7ec4\u80fd\u591f\u6709\u6548\u5730\u5904\u7406\u7ed3\u6784\u5316\u6570\u636e\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u63a9\u7801\u9635\u5217<\/strong>\uff1a\u5141\u8bb8\u7f3a\u5931\u6216\u65e0\u6548\u6570\u636e\u7684\u6570\u7ec4\uff0c\u8fd9\u5bf9\u4e8e\u6570\u636e\u6e05\u7406\u548c\u5904\u7406\u4e0d\u5b8c\u6574\u7684\u6570\u636e\u96c6\u5f88\u6709\u7528\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u8bb0\u5f55\u6570\u7ec4<\/strong>\uff1a\u7ed3\u6784\u5316\u6570\u7ec4\u7684\u53d8\u4f53\uff0c\u4e3a\u6bcf\u4e2a\u5143\u7d20\u63d0\u4f9b\u547d\u540d\u5b57\u6bb5\uff0c\u4ece\u800c\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u8bbf\u95ee\u6570\u636e\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u6d4f\u89c8\u91cf\u548c\u526f\u672c\u6570<\/strong>\uff1aNumPy \u6570\u7ec4\u53ef\u4ee5\u5177\u6709\u89c6\u56fe\u6216\u526f\u672c\uff0c\u8fd9\u4f1a\u5f71\u54cd\u6570\u636e\u7684\u8bbf\u95ee\u548c\u4fee\u6539\u65b9\u5f0f\u3002\u89c6\u56fe\u5f15\u7528\u76f8\u540c\u7684\u57fa\u7840\u6570\u636e\uff0c\u800c\u526f\u672c\u5219\u521b\u5efa\u5355\u72ec\u7684\u6570\u636e\u5b9e\u4f8b\u3002<\/p>\n<\/li>\n<\/ol>\n<h2>NumPy \u7684\u4f7f\u7528\u65b9\u6cd5\u3001\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6cd5<\/h2>\n<p>\u6709\u6548\u4f7f\u7528 NumPy \u9700\u8981\u4e86\u89e3\u5176\u6838\u5fc3\u529f\u80fd\u5e76\u91c7\u7528\u6700\u4f73\u5b9e\u8df5\u3002\u4e00\u4e9b\u5e38\u89c1\u7684\u6311\u6218\u53ca\u5176\u89e3\u51b3\u65b9\u6848\u5305\u62ec\uff1a<\/p>\n<ol>\n<li>\n<p><strong>\u5185\u5b58\u4f7f\u7528\u60c5\u51b5<\/strong>\uff1aNumPy \u6570\u7ec4\u4f1a\u6d88\u8017\u5927\u91cf\u5185\u5b58\uff0c\u5c24\u5176\u662f\u5bf9\u4e8e\u5927\u578b\u6570\u636e\u96c6\u3002\u4e3a\u4e86\u7f13\u89e3\u8fd9\u79cd\u60c5\u51b5\uff0c\u7528\u6237\u5e94\u8003\u8651\u4f7f\u7528\u6570\u636e\u538b\u7f29\u6280\u672f\u6216\u4f7f\u7528 NumPy \u7684\u5185\u5b58\u6620\u5c04\u6570\u7ec4\u6765\u8bbf\u95ee\u78c1\u76d8\u4e0a\u7684\u6570\u636e\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u6027\u80fd\u74f6\u9888<\/strong>\uff1a\u7531\u4e8e\u7528\u6237\u7f16\u5199\u7684\u4ee3\u7801\u6548\u7387\u4f4e\u4e0b\uff0cNumPy \u4e2d\u7684\u67d0\u4e9b\u64cd\u4f5c\u53ef\u80fd\u4f1a\u53d8\u6162\u3002\u5229\u7528\u77e2\u91cf\u5316\u64cd\u4f5c\u5e76\u5229\u7528\u5e7f\u64ad\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8\u6027\u80fd\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u636e\u6e05\u7406\u548c\u7f3a\u5931\u503c<\/strong>\uff1a\u5bf9\u4e8e\u5177\u6709\u7f3a\u5931\u503c\u7684\u6570\u636e\u96c6\uff0c\u4f7f\u7528 NumPy \u7684\u63a9\u7801\u6570\u7ec4\u53ef\u4ee5\u5e2e\u52a9\u6709\u6548\u5730\u5904\u7406\u7f3a\u5931\u6216\u65e0\u6548\u7684\u6570\u636e\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u7ec4\u5e7f\u64ad\u9519\u8bef<\/strong>\uff1a\u5e7f\u64ad\u4f7f\u7528\u4e0d\u5f53\u53ef\u80fd\u4f1a\u5bfc\u81f4\u610f\u5916\u7ed3\u679c\u3002\u8c03\u8bd5\u4e0e\u5e7f\u64ad\u76f8\u5173\u7684\u95ee\u9898\u901a\u5e38\u9700\u8981\u4ed4\u7ec6\u68c0\u67e5\u6570\u7ec4\u5f62\u72b6\u548c\u7ef4\u5ea6\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u503c\u7cbe\u5ea6<\/strong>\uff1aNumPy \u4f7f\u7528\u6709\u9650\u7cbe\u5ea6\u8868\u793a\u6d6e\u70b9\u6570\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5728\u67d0\u4e9b\u8ba1\u7b97\u4e2d\u5f15\u5165\u820d\u5165\u8bef\u5dee\u3002\u5728\u6267\u884c\u5173\u952e\u8ba1\u7b97\u65f6\uff0c\u6ce8\u610f\u6570\u503c\u7cbe\u5ea6\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<\/li>\n<\/ol>\n<h2>\u4e3b\u8981\u7279\u5f81\u4ee5\u53ca\u4e0e\u7c7b\u4f3c\u672f\u8bed\u7684\u5176\u4ed6\u6bd4\u8f83\u4ee5\u8868\u683c\u548c\u5217\u8868\u7684\u5f62\u5f0f<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u7279\u5f81<\/th>\n<th>\u6570\u503c\u6a21\u62df<\/th>\n<th>Python \u4e2d\u7684\u5217\u8868<\/th>\n<th>NumPy \u4e0e\u5217\u8868<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u6570\u636e\u7ed3\u6784<\/td>\n<td>ndarray\uff08\u591a\u7ef4\u6570\u7ec4\uff09<\/td>\n<td>\u5217\u8868\uff08\u4e00\u7ef4\u6570\u7ec4\uff09<\/td>\n<td>NumPy \u6570\u7ec4\u53ef\u4ee5\u6709\u591a\u4e2a\u7ef4\u5ea6\uff0c\u56e0\u6b64\u9002\u5408\u7528\u4e8e\u590d\u6742\u6570\u636e\u3002\u5217\u8868\u662f\u4e00\u7ef4\u7684\uff0c\u8fd9\u9650\u5236\u4e86\u5b83\u4eec\u5728\u79d1\u5b66\u8ba1\u7b97\u4e2d\u7684\u5e94\u7528\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u8868\u73b0<\/td>\n<td>\u9ad8\u6548\u7684\u6570\u7ec4\u64cd\u4f5c<\/td>\n<td>\u7531\u4e8e Python \u7684\u89e3\u91ca\u7279\u6027\uff0c\u901f\u5ea6\u8f83\u6162<\/td>\n<td>NumPy \u7684\u6570\u7ec4\u64cd\u4f5c\u7ecf\u8fc7\u4f18\u5316\uff0c\u4e0e\u5217\u8868\u76f8\u6bd4\uff0c\u8ba1\u7b97\u901f\u5ea6\u660e\u663e\u66f4\u5feb\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u5e7f\u64ad<\/td>\n<td>\u652f\u6301\u5143\u7d20\u7ea7\u64cd\u4f5c\u7684\u5e7f\u64ad<\/td>\n<td>\u4e0d\u76f4\u63a5\u652f\u6301\u5e7f\u64ad<\/td>\n<td>\u5e7f\u64ad\u7b80\u5316\u4e86\u9010\u5143\u7d20\u64cd\u4f5c\u5e76\u51cf\u5c11\u4e86\u5bf9\u663e\u5f0f\u5faa\u73af\u7684\u9700\u8981\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u6570\u5b66\u51fd\u6570<\/td>\n<td>\u4e30\u5bcc\u7684\u6570\u5b66\u51fd\u6570\u96c6\u5408<\/td>\n<td>\u6570\u5b66\u529f\u80fd\u6709\u9650<\/td>\n<td>NumPy \u4e3a\u79d1\u5b66\u8ba1\u7b97\u63d0\u4f9b\u4e86\u5e7f\u6cdb\u7684\u6570\u5b66\u51fd\u6570\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u5185\u5b58\u5229\u7528\u7387<\/td>\n<td>\u9ad8\u6548\u7684\u5185\u5b58\u7ba1\u7406<\/td>\n<td>\u5185\u5b58\u4f7f\u7528\u6548\u7387\u4f4e\u4e0b<\/td>\n<td>NumPy \u7684\u8fde\u7eed\u5185\u5b58\u5e03\u5c40\u5141\u8bb8\u9ad8\u6548\u7684\u5185\u5b58\u5229\u7528\u7387\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u591a\u7ef4\u5207\u7247<\/td>\n<td>\u652f\u6301\u9ad8\u7ea7\u7d22\u5f15\u548c\u5207\u7247<\/td>\n<td>\u5207\u7247\u80fd\u529b\u6709\u9650<\/td>\n<td>NumPy \u7684\u9ad8\u7ea7\u5207\u7247\u529f\u80fd\u5141\u8bb8\u5b9e\u73b0\u591a\u79cd\u6570\u636e\u8bbf\u95ee\u548c\u64cd\u4f5c\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u4e0e NumPy \u76f8\u5173\u7684\u672a\u6765\u89c2\u70b9\u548c\u6280\u672f<\/h2>\n<p>NumPy \u4ecd\u7136\u662f\u6570\u636e\u79d1\u5b66\u548c\u79d1\u5b66\u8ba1\u7b97\u793e\u533a\u7684\u57fa\u672c\u5de5\u5177\u3002\u5b83\u7684\u5e7f\u6cdb\u91c7\u7528\u548c\u6d3b\u8dc3\u7684\u5f00\u53d1\u793e\u533a\u786e\u4fdd\u5b83\u5c06\u5728\u672a\u6765\u51e0\u5e74\u7ee7\u7eed\u6210\u4e3a Python \u751f\u6001\u7cfb\u7edf\u4e2d\u7684\u5173\u952e\u89d2\u8272\u3002<\/p>\n<p>\u968f\u7740\u6280\u672f\u7684\u53d1\u5c55\uff0cNumPy \u53ef\u80fd\u4f1a\u91c7\u7528\u65b0\u7684\u786c\u4ef6\u67b6\u6784\uff0c\u4ece\u800c\u5b9e\u73b0\u66f4\u597d\u7684\u5e76\u884c\u5316\u5e76\u5145\u5206\u5229\u7528\u73b0\u4ee3\u786c\u4ef6\u529f\u80fd\u3002\u6b64\u5916\uff0c\u7b97\u6cd5\u548c\u6570\u503c\u65b9\u6cd5\u7684\u589e\u5f3a\u5c06\u8fdb\u4e00\u6b65\u63d0\u9ad8 NumPy \u7684\u6027\u80fd\u548c\u6548\u7387\u3002<\/p>\n<p>\u968f\u7740\u4eba\u4eec\u5bf9\u673a\u5668\u5b66\u4e60\u548c\u4eba\u5de5\u667a\u80fd\u7684\u5174\u8da3\u65e5\u76ca\u6d53\u539a\uff0cNumPy \u5c06\u5728\u652f\u6301\u9ad8\u7ea7\u7b97\u6cd5\u7684\u5f00\u53d1\u548c\u4f18\u5316\u65b9\u9762\u53d1\u6325\u91cd\u8981\u4f5c\u7528\u3002\u9884\u8ba1\u5b83\u5c06\u7ee7\u7eed\u6210\u4e3a\u9ad8\u7ea7\u5e93\u548c\u6846\u67b6\u7684\u652f\u67f1\uff0c\u4fc3\u8fdb\u9ad8\u6548\u7684\u6570\u636e\u5904\u7406\u548c\u6570\u503c\u8ba1\u7b97\u3002<\/p>\n<h2>\u5982\u4f55\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668\u6216\u5c06\u5176\u4e0e NumPy \u5173\u8054<\/h2>\n<p>\u4ee3\u7406\u670d\u52a1\u5668\u5145\u5f53\u5ba2\u6237\u7aef\u8bbe\u5907\u548c Web \u670d\u52a1\u5668\u4e4b\u95f4\u7684\u4e2d\u4ecb\uff0c\u63d0\u4f9b\u533f\u540d\u6027\u3001\u5b89\u5168\u6027\u548c\u5185\u5bb9\u8fc7\u6ee4\u7b49\u5404\u79cd\u4f18\u52bf\u3002\u867d\u7136 NumPy \u672c\u8eab\u53ef\u80fd\u4e0e\u4ee3\u7406\u670d\u52a1\u5668\u6ca1\u6709\u76f4\u63a5\u5173\u7cfb\uff0c\u4f46\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5c06 NumPy \u4e0e\u4ee3\u7406\u670d\u52a1\u5668\u7ed3\u5408\u4f7f\u7528\u53ef\u80fd\u4f1a\u5f88\u6709\u4ef7\u503c\u3002<\/p>\n<ol>\n<li>\n<p><strong>\u4ee3\u7406\u65e5\u5fd7\u7684\u6570\u636e\u5206\u6790<\/strong>\uff1a\u4ee3\u7406\u670d\u52a1\u5668\u751f\u6210\u5305\u542b\u7528\u6237\u6d3b\u52a8\u6570\u636e\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u53ef\u4ee5\u5229\u7528 NumPy \u9ad8\u6548\u5730\u5904\u7406\u548c\u5206\u6790\u8fd9\u4e9b\u65e5\u5fd7\uff0c\u63d0\u53d6\u89c1\u89e3\u5e76\u8bc6\u522b\u7528\u6237\u884c\u4e3a\u6a21\u5f0f\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u9ad8\u6548\u6570\u636e\u8fc7\u6ee4<\/strong>\uff1a\u4ee3\u7406\u670d\u52a1\u5668\u7ecf\u5e38\u9700\u8981\u8fc7\u6ee4\u6389\u7f51\u9875\u4e2d\u4e0d\u9700\u8981\u7684\u5185\u5bb9\u3002NumPy \u7684\u6570\u7ec4\u8fc7\u6ee4\u529f\u80fd\u53ef\u7528\u4e8e\u7b80\u5316\u6b64\u8fc7\u7a0b\u5e76\u63d0\u9ad8\u6574\u4f53\u6027\u80fd\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u7f51\u7edc\u6d41\u91cf\u7edf\u8ba1\u5206\u6790<\/strong>\uff1aNumPy \u53ef\u4ee5\u5e2e\u52a9\u5206\u6790\u4ee3\u7406\u670d\u52a1\u5668\u6536\u96c6\u7684\u7f51\u7edc\u6d41\u91cf\u6570\u636e\uff0c\u4f7f\u7ba1\u7406\u5458\u80fd\u591f\u8bc6\u522b\u5f02\u5e38\u6a21\u5f0f\u3001\u6f5c\u5728\u7684\u5b89\u5168\u5a01\u80c1\u5e76\u4f18\u5316\u670d\u52a1\u5668\u6027\u80fd\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u4ee3\u7406\u7ba1\u7406\u7684\u673a\u5668\u5b66\u4e60<\/strong>\uff1aNumPy \u662f\u5404\u79cd\u673a\u5668\u5b66\u4e60\u5e93\u7684\u91cd\u8981\u7ec4\u6210\u90e8\u5206\u3002\u4ee3\u7406\u63d0\u4f9b\u5546\u53ef\u4ee5\u4f7f\u7528\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u6765\u4f18\u5316\u4ee3\u7406\u670d\u52a1\u5668\u7ba1\u7406\uff0c\u9ad8\u6548\u5206\u914d\u8d44\u6e90\u5e76\u68c0\u6d4b\u6f5c\u5728\u7684\u6ee5\u7528\u884c\u4e3a\u3002<\/p>\n<\/li>\n<\/ol>\n<h2>\u76f8\u5173\u94fe\u63a5<\/h2>\n<p>\u6709\u5173 NumPy \u7684\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u8003\u8651\u63a2\u7d22\u4ee5\u4e0b\u8d44\u6e90\uff1a<\/p>\n<ol>\n<li>NumPy\u5b98\u65b9\u7f51\u7ad9\uff1a <a href=\"https:\/\/numpy.org\/\" target=\"_new\" rel=\"noopener nofollow\">https:\/\/numpy.org\/<\/a><\/li>\n<li>NumPy \u6587\u6863\uff1a <a href=\"https:\/\/numpy.org\/doc\/\" target=\"_new\" rel=\"noopener nofollow\">https:\/\/numpy.org\/doc\/<\/a><\/li>\n<li>SciPy\uff1a <a href=\"https:\/\/www.scipy.org\/\" target=\"_new\" rel=\"noopener nofollow\">https:\/\/www.scipy.org\/<\/a><\/li>\n<li>NumPy GitHub \u5b58\u50a8\u5e93\uff1a <a href=\"https:\/\/github.com\/numpy\/numpy\" target=\"_new\" rel=\"noopener nofollow\">https:\/\/github.com\/numpy\/numpy<\/a><\/li>\n<\/ol>\n<p>NumPy \u51ed\u501f\u5176\u5f3a\u5927\u7684\u6570\u7ec4\u5904\u7406\u80fd\u529b\uff0c\u7ee7\u7eed\u4e3a\u4e16\u754c\u5404\u5730\u7684\u5f00\u53d1\u4eba\u5458\u548c\u79d1\u5b66\u5bb6\u63d0\u4f9b\u652f\u6301\uff0c\u4fc3\u8fdb\u4f17\u591a\u9886\u57df\u7684\u521b\u65b0\u3002\u65e0\u8bba\u60a8\u662f\u5728\u8fdb\u884c\u6570\u636e\u79d1\u5b66\u9879\u76ee\u3001\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u8fd8\u662f\u79d1\u5b66\u7814\u7a76\uff0cNumPy \u4ecd\u7136\u662f Python \u4e2d\u9ad8\u6548\u6570\u503c\u8ba1\u7b97\u7684\u4e0d\u53ef\u6216\u7f3a\u7684\u5de5\u5177\u3002<\/p>","protected":false},"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":false,"content-type":"","inline_featured_image":false,"footnotes":""},"class_list":["post-478240","wiki","type-wiki","status-publish","hentry"],"acf":{"faq_title":"Frequently Asked Questions about <mark>NumPy: The Foundation of Efficient Numerical Computing<\/mark>","faq_items":[{"question":"What is NumPy?","answer":"<p>NumPy, short for \"Numerical Python,\" is a fundamental library for numerical computing in the Python programming language. It provides support for large, multi-dimensional arrays and matrices, along with a collection of mathematical functions to operate on these arrays efficiently. NumPy is an open-source project and has become a crucial component in various domains such as data science, machine learning, scientific research, and engineering.<\/p>"},{"question":"How did NumPy originate, and when was it first introduced?","answer":"<p>NumPy originated from the desire to have a more efficient array processing capability in Python. The foundation of NumPy was laid by Jim Hugunin, who created the Numeric library in 1995. Numeric was the first array processing package for Python and served as the precursor to NumPy.<\/p><p>In 2005, Travis Oliphant combined the best features of Numeric and another library called \"numarray\" to create NumPy. This new library aimed to address the limitations of the previous packages and provide a powerful array manipulation toolset to Python developers. With its introduction, NumPy quickly gained popularity and recognition among researchers, engineers, and data scientists.<\/p>"},{"question":"What are the key features of NumPy?","answer":"<p>NumPy offers several key features that make it an indispensable tool for numerical computing in Python:<\/p><ul><li>Efficient array operations for faster computations<\/li><li>Support for multi-dimensional arrays, enabling complex data handling<\/li><li>Broadcasting for element-wise operations on arrays with different shapes<\/li><li>A wide range of mathematical functions for scientific computing<\/li><li>Interoperability with other Python libraries and data structures<\/li><li>Vectorized operations for concise and maintainable code<\/li><\/ul>"},{"question":"What types of NumPy arrays exist?","answer":"<p>NumPy provides various types of arrays to accommodate different data requirements:<\/p><ul><li><strong>ndarray<\/strong>: The primary array type, capable of holding elements of the same data type in multiple dimensions.<\/li><li><strong>Structured arrays<\/strong>: Arrays that can hold heterogeneous data types, allowing for efficient handling of structured data.<\/li><li><strong>Masked arrays<\/strong>: Arrays that allow for missing or invalid data, useful for data cleaning and handling incomplete datasets.<\/li><li><strong>Record arrays<\/strong>: A variation of structured arrays that provide named fields for each element, simplifying data access.<\/li><\/ul>"},{"question":"How can I use NumPy effectively?","answer":"<p>Using NumPy effectively involves understanding its core functionalities and adopting best practices:<\/p><ul><li>Optimize memory usage for large datasets by considering data compression or memory-mapped arrays.<\/li><li>Utilize vectorized operations and broadcasting to improve performance.<\/li><li>Handle missing values with masked arrays for efficient data cleaning.<\/li><li>Be cautious of numerical precision to avoid rounding errors in critical computations.<\/li><\/ul>"},{"question":"How does NumPy compare to Python lists?","answer":"<p>NumPy arrays and Python lists have several differences:<\/p><ul><li>NumPy arrays can have multiple dimensions, while lists are one-dimensional.<\/li><li>NumPy's array operations are optimized and faster than traditional Python lists and loops.<\/li><li>Broadcasting simplifies element-wise operations with NumPy, which is not directly supported with lists.<\/li><li>NumPy provides an extensive collection of mathematical functions, which is limited in Python lists.<\/li><\/ul>"},{"question":"What does the future hold for NumPy?","answer":"<p>As technology evolves, NumPy is likely to embrace new hardware architectures, enabling better parallelization and utilization of modern hardware capabilities. Enhancements in algorithms and numerical methods will further improve NumPy's performance and efficiency.<\/p><p>With the growing interest in machine learning and artificial intelligence, NumPy will continue to support the development and optimization of advanced algorithms, remaining a crucial tool in the data science and scientific computing community.<\/p>"},{"question":"How can proxy servers be associated with NumPy?","answer":"<p>While NumPy itself may not be directly related to proxy servers, there are scenarios where using NumPy in conjunction with proxy servers can be valuable. For instance:<\/p><ul><li>Data analysis can be performed on proxy logs using NumPy to extract insights from user activity data.<\/li><li>NumPy's array filtering capabilities can help proxy servers efficiently filter out unwanted content from web pages.<\/li><li>Proxy providers can use machine learning algorithms with NumPy to optimize server management and resource allocation.<\/li><\/ul><p>Explore the potential of NumPy in conjunction with proxy servers to enhance data processing and optimize server operations.<\/p>"}]},"_links":{"self":[{"href":"https:\/\/oneproxy.pro\/cn\/wp-json\/wp\/v2\/wiki\/478240","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oneproxy.pro\/cn\/wp-json\/wp\/v2\/wiki"}],"about":[{"href":"https:\/\/oneproxy.pro\/cn\/wp-json\/wp\/v2\/types\/wiki"}],"version-history":[{"count":0,"href":"https:\/\/oneproxy.pro\/cn\/wp-json\/wp\/v2\/wiki\/478240\/revisions"}],"wp:attachment":[{"href":"https:\/\/oneproxy.pro\/cn\/wp-json\/wp\/v2\/media?parent=478240"}],"curies":[{"name":"\u53ef\u6e7f\u6027\u7c89\u5242","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}