{"id":5075,"date":"2020-04-22T21:08:11","date_gmt":"2020-04-22T13:08:11","guid":{"rendered":"https:\/\/vip.fxxkpython.com\/?p=5075"},"modified":"2020-04-22T21:13:45","modified_gmt":"2020-04-22T13:13:45","slug":"python-%e6%95%b0%e6%8d%ae%e5%8f%af%e8%a7%86%e5%8c%96-02-numpy-%e6%95%b0%e6%8d%ae%e6%93%8d%e4%bd%9c%e4%b9%8b-array","status":"publish","type":"post","link":"https:\/\/vip.fxxkpython.com\/?p=5075","title":{"rendered":"Python \u6570\u636e\u53ef\u89c6\u5316 02 | NumPy \u6570\u636e\u64cd\u4f5c\u4e4b Array"},"content":{"rendered":"\n<h2>\u4ec0\u4e48\u662f NumPy\uff1f<\/h2>\n\n\n\n<p>\u6211\u4eec\u4e4b\u524d\u5728\u5b66\u4e60 Python \u57fa\u7840\u7684\u65f6\u5019\uff0c\u77e5\u9053\u4e86\u4e00\u4e9b Python \u7684\u6570\u636e\u7c7b\u578b\uff0c\u6bd4\u5982\u5217\u8868\uff0c\u5143\u7ec4\uff0c\u5b57\u5178\u8fd9\u4e9b\uff0c\u800c Numpy \u662f\u4e13\u95e8\u7528\u6765\u521b\u5efa\u6570\u7ec4\u7684\u2014\u2014\u6570\u7ec4\uff0c\u4e5f\u662f\u4e00\u79cd\u6570\u636e\u7c7b\u578b\u3002<\/p>\n\n\n\n<p>\u56e0\u4e3a\u6211\u4eec\u8981\u73a9\u6570\u636e\u53ef\u89c6\u5316\uff0c\u9700\u8981\u64cd\u4f5c\u5230\u6570\u636e\uff0c\u800c\u6570\u7ec4\u5c31\u5e38\u5e38\u4f1a\u88ab\u6211\u4f7f\u7528\u5230\uff0c Numpy \u662f Python \u4e2d\u5f88\u5e38\u7528\u7684\u79d1\u5b66\u8ba1\u7b97\u5e93\uff0c\u5b83\u53ef\u4ee5\u521b\u5efa\u51fa\u51e0\u4e4e\u4f60\u80fd\u60f3\u5230\u7684\u5404\u5f0f\u5404\u6837\u7684\u6570\u636e\uff0c\u6bd4\u5982\u591a\u7ef4\u6570\u7ec4\uff0c\u77e9\u9635\u8fd9\u4e9b\uff0c\u800c\u4e14\u53ef\u4ee5\u901a\u8fc7 NumPy \u8f7b\u677e\u5feb\u901f\u7684\u53bb\u64cd\u4f5c\u8fd9\u4e9b\u6570\u636e\uff0c\u8fd9\u4e00\u70b9\u4f60\u5728\u540e\u9762\u5e94\u8be5\u4f1a\u6709\u4f53\u4f1a\u7684\u3002<\/p>\n\n\n\n<p>\u4eca\u5929\uff0c\u5c0f\u5e05b\u4e3b\u8981\u6765\u7ed9\u4f60\u8bf4\u8bf4\u5982\u4f55\u4f7f\u7528 Numpy \u6765\u64cd\u4f5c\u6570\u636e\u2014\u2014\u5e38\u5e38\u7528\u5230\u7684\u6570\u7ec4\u4f7f\u7528\u3002<\/p>\n\n\n\n<p>\u73b0\u5728\u6253\u5f00\u4f60\u7684 Juypter \uff0c\u8ddf\u6211\u4e00\u8d77\u4e00\u6b65\u4e00\u6b65\u7684\u73a9\u8d77\u6765\u5427\u3002<\/p>\n\n\n\n<p> \u5148\u5bfc\u5165 Numpy \uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"1024\" height=\"90\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-18-02-13-1024x90.png\" alt=\"\" class=\"wp-image-5076\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-18-02-13-1024x90.png 1024w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-18-02-13-300x26.png 300w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-18-02-13-768x68.png 768w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-18-02-13-769x68.png 769w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-18-02-13.png 1124w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<h2>\u4f7f\u7528 NumPy \u521b\u5efa\u6570\u7ec4<\/h2>\n\n\n\n<p>Numpy \u521b\u5efa\u6570\u7ec4\u7684\u65b9\u5f0f\u6709\u597d\u51e0\u79cd\uff0c\u6211\u4eec\u5148\u4ee5\u4f60\u6700\u719f\u6089\u7684\u5217\u8868\u5207\u5165\u5427\u3002<\/p>\n\n\n\n<h3>\u5217\u8868\u8f6c\u5316\u4e3a\u6570\u7ec4<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"535\" height=\"205\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-18-06-27.png\" alt=\"\" class=\"wp-image-5077\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-18-06-27.png 535w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-18-06-27-300x115.png 300w\" sizes=\"(max-width: 535px) 100vw, 535px\" \/><\/figure><\/div>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c \u901a\u8fc7\u8c03\u7528 np \u7684 array \u65b9\u6cd5\u5c31\u53ef\u4ee5\u5c06\u5217\u8868\u8f6c\u5316\u4e3a\u6570\u7ec4\u4e86\u3002\u53ef\u80fd\u4f60\u4f1a\u60f3\uff0c\u8fd9\u4e24\u73a9\u610f\u4e0d\u662f\u5dee\u4e0d\u591a\u4e48\uff1f<\/p>\n\n\n\n<p>\u6570\u7ec4\u548c\u5217\u8868\u7684\u4e00\u4e9b\u64cd\u4f5c\u662f\u5f88\u7c7b\u4f3c\uff0c\u6bd4\u5982\u901a\u8fc7\u4e0b\u6807\u8bbf\u95ee\u5177\u4f53\u5143\u7d20\uff0c\u5207\u7247\uff0c\u5faa\u73af\u7b49\uff0c\u4f46\u662f\u4e5f\u6709\u4e0d\u4e00\u6837\u7684\u5730\u65b9\uff0c\u6bd4\u5982\u6570\u7ec4\u7684\u5927\u5c0f\u662f\u56fa\u5b9a\u7684\uff0c\u4e0d\u50cf\u5217\u8868\u90a3\u6837\u53ef\u53d8\uff0c\u800c\u4e14\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\u7684\u6570\u636e\u7c7b\u578b\u9700\u8981\u4fdd\u6301\u4e00\u81f4&#8230;.\u5173\u4e8e\u5b83\u4eec\u7684\u533a\u522b\uff0c\u5f80\u540e\u6211\u5728\u8ddf\u4f60\u8bf4\u6570\u636e\u7ed3\u6784\u7684\u65f6\u5019\uff0c\u4f1a\u63d0\u5230\u7684\uff0c\u73b0\u5728\u4f60\u53ea\u8981\u4e86\u89e3\u5e76\u719f\u6089\u4f7f\u7528 np \u7684\u6570\u636e\u64cd\u4f5c\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n\n\n\n<p>\u521a\u521a\u6211\u4eec\u5f97\u5230\u7684\u662f\u4e00\u4e2a\u4e00\u7ef4\u6570\u7ec4\uff0c\u800c\u6570\u7ec4\u53ef\u4ee5\u662f\u591a\u7ef4\u7684\uff0c\u6bd4\u5982\u4e8c\u7ef4\u6570\u7ec4\uff0c\u77e9\u9635\u3002\u6bd4\u5982\u6211\u4eec\u60f3\u8981\u5c06\u591a\u4e2a\u5217\u8868\u5408\u6210\u4e00\u4e2a\u591a\u7ef4\u6570\u7ec4\uff0c\u5c31\u53ef\u4ee5\u8fd9\u6837\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"527\" height=\"191\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-18-15-27.png\" alt=\"\" class=\"wp-image-5078\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-18-15-27.png 527w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-18-15-27-300x109.png 300w\" sizes=\"(max-width: 527px) 100vw, 527px\" \/><\/figure><\/div>\n\n\n\n<h3>\u901a\u8fc7 arange \u521b\u5efa\u6570\u7ec4<\/h3>\n\n\n\n<p>\u5728\u4f7f\u7528\u5217\u8868\u7684\u65f6\u5019\u6211\u4eec\u5e38\u4f1a\u7528\u5230 range \u51fd\u6570\uff0c\u800c\u8fd9\u91cc\u7684 arange \u6765\u751f\u6210\u6570\u7ec4\u7684\u65b9\u5f0f\u4e5f\u662f\u5dee\u4e0d\u591a\u7684\uff1a<div style=\"text-align:center;border:1px dashed #FF9A9A;padding:8px;margin:10px auto;color:#FF6666;\">\u672c\u6587\u9690\u85cf\u5185\u5bb9 <a href=\"https:\/\/vip.fxxkpython.com\/wp-login.php?redirect_to=https%3A%2F%2Fvip.fxxkpython.com%2F%3Fp%3D5075\">\u767b\u9646<\/a> \u540e\u624d\u53ef\u4ee5\u6d4f\u89c8<\/div>\u4e3e\u4e2a\u7b80\u5355\u4f8b\u5b50\uff0c\u521b\u5efa\u4e24\u6570\u7ec4\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"671\" height=\"267\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-21-03-12.png\" alt=\"\" class=\"wp-image-5093\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-21-03-12.png 671w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-21-03-12-300x119.png 300w\" sizes=\"(max-width: 671px) 100vw, 671px\" \/><\/figure><\/div>\n\n\n\n<p>\u7b97\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"594\" height=\"351\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-21-03-51.png\" alt=\"\" class=\"wp-image-5094\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-21-03-51.png 594w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-22-21-03-51-300x177.png 300w\" sizes=\"(max-width: 594px) 100vw, 594px\" \/><\/figure><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>ok\uff0c\u4ee5\u4e0a\u5c31\u662f\u672c\u7bc7\u8981\u7ed9\u4f60\u4ecb\u7ecd\u7684\u5185\u5bb9\u3002<\/p>\n\n\n\n<p>ps\uff1a\u4ee5\u4e0a\u64cd\u4f5c\u7684\u4ee3\u7801\uff1a<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/wistbean\/fxxkpython\/blob\/master\/code\/data_visualization\/Numpy_array.ipynb\">https:\/\/github.com\/wistbean\/fxxkpython\/blob\/master\/code\/data_visualization\/Numpy_array.ipynb<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ec0\u4e48\u662f NumPy\uff1f \u6211\u4eec\u4e4b\u524d\u5728\u5b66\u4e60 Python \u57fa\u7840\u7684\u65f6\u5019\uff0c\u77e5\u9053\u4e86\u4e00\u4e9b Python \u7684\u6570\u636e\u7c7b\u578b\uff0c\u6bd4\u5982\u5217\u8868\uff0c\u5143\u7ec4\uff0c\u5b57\u5178\u8fd9\u4e9b\uff0c\u800c Numpy \u662f\u4e13\u95e8\u7528\u6765\u521b\u5efa\u6570\u7ec4\u7684\u2014\u2014\u6570\u7ec4\uff0c\u4e5f\u662f\u4e00\u79cd\u6570\u636e\u7c7b\u578b\u3002 \u56e0\u4e3a\u6211\u4eec\u8981\u73a9\u6570\u636e\u53ef\u89c6\u5316\uff0c\u9700\u8981\u64cd\u4f5c\u5230\u6570\u636e\uff0c\u800c\u6570\u7ec4\u5c31\u5e38\u5e38\u4f1a\u88ab&hellip;<\/p>\n","protected":false},"author":1,"featured_media":5084,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[393],"tags":[402,19,405,404],"_links":{"self":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/5075"}],"collection":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5075"}],"version-history":[{"count":4,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/5075\/revisions"}],"predecessor-version":[{"id":5098,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/5075\/revisions\/5098"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/media\/5084"}],"wp:attachment":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}