{"id":1026,"date":"2021-07-09T12:50:05","date_gmt":"2021-07-09T12:50:05","guid":{"rendered":"https:\/\/www.bearloga.space\/?page_id=1026"},"modified":"2021-07-09T12:50:05","modified_gmt":"2021-07-09T12:50:05","slug":"numpy-chast-1-nachalo-raboty","status":"publish","type":"page","link":"https:\/\/www.bearloga.space\/uk\/numpy-chast-1-nachalo-raboty\/","title":{"rendered":"NumPy, \u0447\u0430\u0441\u0442\u044c 1: \u043d\u0430\u0447\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u044b"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">NumPy \u2014 \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u044f\u0437\u044b\u043a\u0430 Python, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0449\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0438 \u043c\u0430\u0442\u0440\u0438\u0446, \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 (\u0438 \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u044b\u0445) \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u044d\u0442\u0438\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 NumPy<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0430 linux &#8211; \u043f\u0430\u043a\u0435\u0442 python3-numpy (\u0438\u043b\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b), \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437&nbsp;<a href=\"https:\/\/pythonworld.ru\/osnovy\/pip.html\" target=\"_blank\" rel=\"noreferrer noopener\">pip<\/a>. \u041d\u0443 \u0438\u043b\u0438 \u0436\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432&nbsp;<a href=\"https:\/\/sourceforge.net\/projects\/numpy\/files\/NumPy\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/sourceforge.net\/projects\/numpy\/files\/NumPy\/<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0430 Windows \u043d\u0430 \u0442\u043e\u043c \u0436\u0435 \u0441\u0430\u0439\u0442\u0435 \u0435\u0441\u0442\u044c exe \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0449\u0438\u043a\u0438. \u0418\u043b\u0438, \u0435\u0441\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0435\u0449\u0451 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0441\u0431\u043e\u0440\u043d\u0438\u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a&nbsp;<a href=\"http:\/\/www.lfd.uci.edu\/~gohlke\/pythonlibs\/#numpy\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/www.lfd.uci.edu\/~gohlke\/pythonlibs\/#numpy<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c NumPy \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 (\u0432 numpy \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f numpy.ndarray). \u042d\u0442\u043e \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 (\u043e\u0431\u044b\u0447\u043d\u043e \u0447\u0438\u0441\u0435\u043b), \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 ndarray:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>ndarray.ndim<\/strong>&nbsp;&#8211; \u0447\u0438\u0441\u043b\u043e \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 (\u0447\u0430\u0449\u0435 \u0438\u0445 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 &#8220;\u043e\u0441\u0438&#8221;) \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>ndarray.shape<\/strong>&nbsp;&#8211; \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0435\u0433\u043e \u0444\u043e\u0440\u043c\u0430. \u042d\u0442\u043e \u043a\u043e\u0440\u0442\u0435\u0436 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0434\u043b\u0438\u043d\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u0441\u0438. \u0414\u043b\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438\u0437 n \u0441\u0442\u0440\u043e\u043a \u0438 m \u0441\u0442\u043e\u043b\u0431\u043e\u0432, shape \u0431\u0443\u0434\u0435\u0442 (n,m). \u0427\u0438\u0441\u043b\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u0440\u0442\u0435\u0436\u0430 shape \u0440\u0430\u0432\u043d\u043e ndim.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>ndarray.size<\/strong>&nbsp;&#8211; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044e \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 shape.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>ndarray.dtype<\/strong>&nbsp;&#8211; \u043e\u0431\u044a\u0435\u043a\u0442, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0442\u0438\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u041c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c dtype, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Python. NumPy \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0446\u0435\u043b\u044b\u0439 \u0431\u0443\u043a\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043a\u0430\u043a \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: bool_, character, int8, int16, int32, int64, float8, float16, float32, float64, complex64, object_, \u0442\u0430\u043a \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u0435.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>ndarray.itemsize<\/strong>&nbsp;&#8211; \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>ndarray.data<\/strong>&nbsp;&#8211; \u0431\u0443\u0444\u0435\u0440, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u041e\u0431\u044b\u0447\u043d\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412 NumPy \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432. \u041e\u0434\u0438\u043d \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 &#8211; \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u0438\u043b\u0438 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439 Python, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e numpy.array() (\u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u0435: array &#8211; \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0430\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 ndarray):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong>>>> import<\/strong> <strong>numpy<\/strong> <strong>as<\/strong> <strong>np<\/strong>\n<strong>>>> <\/strong>a = np.array([1, 2, 3])\n<strong>>>> <\/strong>a\narray([1, 2, 3])\n<strong>>>> <\/strong>type(a)\n&lt;class 'numpy.ndarray'><\/code>\n\n\n\u0424\u0443\u043d\u043a\u0446\u0438\u044f array() \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b. \u0422\u0438\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u0438\u043f\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 (\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f).\n<code><strong>>>> <\/strong>b = np.array([[1.5, 2, 3], [4, 5, 6]]) \n<strong>>>> <\/strong>b array([[ 1.5,  2. ,  3. ],   \n     [ 4. ,  5. ,  6. ]])<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u041c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0438\u043f \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong>>>> <\/strong>b = np.array([[1.5, 2, 3], [4, 5, 6]], dtype=np.complex)\n<strong>>>> <\/strong>b\narray([[ 1.5+0.j,  2.0+0.j,  3.0+0.j],\n       [ 4.0+0.j,  5.0+0.j,  6.0+0.j]])<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f array() \u043d\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b, \u0430 \u043c\u0430\u0441\u0441\u0438\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f, \u0443\u0436\u0435 \u043d\u0443\u0436\u0435\u043d. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0442\u0438\u043f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u2014 float64).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f zeros() \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u043d\u0443\u043b\u0435\u0439, \u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f ones() \u2014 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446. \u041e\u0431\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u043a\u043e\u0440\u0442\u0435\u0436 \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c\u0438, \u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 dtype:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong>>>> <\/strong>np.zeros((3, 5))\narray([[ 0.,  0.,  0.,  0.,  0.],\n       [ 0.,  0.,  0.,  0.,  0.],\n       [ 0.,  0.,  0.,  0.,  0.]])\n<strong>>>> <\/strong>np.ones((2, 2, 2))\narray([[[ 1.,  1.],\n        [ 1.,  1.]],\n\n       [[ 1.,  1.],\n        [ 1.,  1.]]])<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f eye() \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 (\u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>&gt;&gt;&gt; <\/strong>np.eye(5)\narray([[ 1.,  0.,  0.,  0.,  0.],\n       [ 0.,  1.,  0.,  0.,  0.],\n       [ 0.,  0.,  1.,  0.,  0.],\n       [ 0.,  0.,  0.,  1.,  0.],\n       [ 0.,  0.,  0.,  0.,  1.]])<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f empty() \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0435\u0437 \u0435\u0433\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0418\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 (\u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0442 \u0442\u043e\u0433\u043e \u043c\u0443\u0441\u043e\u0440\u0430, \u0447\u0442\u043e \u0432 \u043d\u0435\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>&gt;&gt;&gt; <\/strong>np.empty((3, 3))\narray([[  6.93920488e-310,   6.93920488e-310,   6.93920149e-310],\n       [  6.93920058e-310,   6.93920058e-310,   6.93920058e-310],\n       [  6.93920359e-310,   0.00000000e+000,   6.93920501e-310]])\n<strong>&gt;&gt;&gt; <\/strong>np.empty((3, 3))\narray([[  6.93920488e-310,   6.93920488e-310,   6.93920147e-310],\n       [  6.93920149e-310,   6.93920146e-310,   6.93920359e-310],\n       [  6.93920359e-310,   0.00000000e+000,   3.95252517e-322]])<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0447\u0438\u0441\u0435\u043b, \u0432 NumPy \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f arange(), \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0432 Python range(), \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u043e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u044b, \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0446\u0435\u043b\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>&gt;&gt;&gt; <\/strong>np.arange(10, 30, 5)\narray([10, 15, 20, 25])\n<strong>&gt;&gt;&gt; <\/strong>np.arange(0, 1, 0.1)\narray([ 0. ,  0.1,  0.2,  0.3,  0.4,  0.5,  0.6,  0.7,  0.8,  0.9])<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412\u043e\u043e\u0431\u0449\u0435, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 arange() \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0442\u0438\u043f\u0430 float, \u0441\u043b\u043e\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u043c \u0432 \u0442\u043e\u043c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e (\u0438\u0437-\u0437\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0447\u0438\u0441\u0435\u043b \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439). \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0432 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043e\u0431\u044b\u0447\u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e linspace(), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043c\u0435\u0441\u0442\u043e \u0448\u0430\u0433\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e, \u0440\u0430\u0432\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043d\u0443\u0436\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>&gt;&gt;&gt; <\/strong>np.linspace(0, 2, 9)  <em># 9 \u0447\u0438\u0441\u0435\u043b \u043e\u0442 0 \u0434\u043e 2 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e<\/em>\narray([  0. ,  0.25,  0.5 ,  0.75, 1. , 1.25, 1.5 , 1.75, 2. ])<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">fromfunction(): \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043a\u043e \u0432\u0441\u0435\u043c \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>&gt;&gt;&gt; <\/strong><strong>def<\/strong> f1(i, j):\n<strong>... <\/strong>    <strong>return<\/strong> 3 * i + j\n<strong>...<\/strong>\n<strong>&gt;&gt;&gt; <\/strong>np.fromfunction(f1, (3, 4))\narray([[ 0.,  1.,  2.,  3.],\n       [ 3.,  4.,  5.,  6.],\n       [ 6.,  7.,  8.,  9.]])\n<strong>&gt;&gt;&gt; <\/strong>np.fromfunction(f1, (3, 3))\narray([[ 0.,  1.,  2.],\n       [ 3.,  4.,  5.],\n       [ 6.,  7.,  8.]])<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u041f\u0435\u0447\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0415\u0441\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c, NumPy \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0433\u043e \u0443\u0433\u043e\u043b\u043a\u0438.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>&gt;&gt;&gt; <\/strong>print(np.arange(0, 3000, 1))\n[   0    1    2 ..., 2997 2998 2999]<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u0435\u0441\u044c \u043c\u0430\u0441\u0441\u0438\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e numpy.set_printoptions:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">np.set_printoptions(threshold=np.nan)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0418 \u0432\u043e\u043e\u0431\u0449\u0435, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0435\u0447\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 &#8220;\u043f\u043e\u0434 \u0441\u0435\u0431\u044f&#8221;. \u0424\u0443\u043d\u043a\u0446\u0438\u044f numpy.set_printoptions \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>precision<\/em>&nbsp;: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u044b\u0445 \u0446\u0438\u0444\u0440 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 8).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>threshold<\/em>&nbsp;: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u043e\u0431\u0440\u0435\u0437\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 1000).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>edgeitems<\/em>&nbsp;: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 3).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>linewidth<\/em>&nbsp;: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043d\u043e\u0441 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 75).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>suppress<\/em>&nbsp;: \u0435\u0441\u043b\u0438 True, \u043d\u0435 \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 scientific notation (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e False).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>nanstr<\/em>&nbsp;: \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 NaN (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e &#8216;nan&#8217;).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>infstr<\/em>&nbsp;: \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 inf (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e &#8216;inf&#8217;).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>formatter<\/em>&nbsp;: \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u043d\u043a\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0435\u0447\u0430\u0442\u044c\u044e \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432. \u0417\u0434\u0435\u0441\u044c \u044f \u0435\u0433\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c&nbsp;<a href=\"https:\/\/docs.scipy.org\/doc\/numpy\/reference\/generated\/numpy.set_printoptions.html\" target=\"_blank\" rel=\"noreferrer noopener\">\u0437\u0434\u0435\u0441\u044c<\/a>&nbsp;(\u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>NumPy \u2014 \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u044f\u0437\u044b\u043a\u0430 Python, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0449\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0438 \u043c\u0430\u0442\u0440\u0438\u0446, \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 (\u0438 \u043e\u0447\u0435\u043d\u044c [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[77],"tags":[],"class_list":["post-1026","page","type-page","status-publish","hentry","category-numpy"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages\/1026","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/comments?post=1026"}],"version-history":[{"count":0,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages\/1026\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/media?parent=1026"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/categories?post=1026"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/tags?post=1026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}