{"id":383041,"date":"2024-06-29T04:39:12","date_gmt":"2024-06-29T04:39:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=383041"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T04:39:12","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=383041","title":{"rendered":"<span>\u041d\u043e\u0432\u044b\u0439 Numpy 1.20.0 \u2014 \u0447\u0442\u043e \u0442\u0443\u0434\u0430 \u0437\u0430\u0432\u0435\u0437\u043b\u0438 \u0438 \u0441\u0442\u043e\u0438\u0442 \u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c?<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0414\u0440\u0443\u0437\u044c\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u044b\u0448\u0435\u043b \u043d\u043e\u0432\u044b\u0439 \u0440\u0435\u043b\u0438\u0437 Numpy 1.20.0 \u0438 \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c, \u0447\u0442\u043e \u0442\u0443\u0434\u0430 \u0437\u0430\u0432\u0435\u0437\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e. <\/p>\n<p>\u0421\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439, \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u043d\u0435 \u0432\u0441\u0435 &#8212; \u0438\u043d\u0430\u0447\u0435 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441 \u0433\u043e\u043b\u043e\u0432\u043e\u0439 \u043f\u043e\u0433\u0440\u044f\u0437\u043d\u0435\u043c \u0432 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438 \u0434\u043e\u043a\u0438. \u041f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 (\u043d\u0430 \u043d\u0430\u0448 \u0441\u043a\u0440\u043e\u043c\u043d\u044b\u0439 \u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434). \u0415\u0441\u043b\u0438 \u0412\u044b \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0435 \u0435\u0449\u0435 \u0447\u0442\u043e-\u0442\u043e \u0432\u0430\u0436\u043d\u043e\u0435, \u043e \u0447\u0435\u043c \u043c\u044b \u043d\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b\u0438 &#8212; \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445! <\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c. <\/p>\n<h2>\u041d\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/h2>\n<h3>\u0412 \u043a\u043b\u0430\u0441\u0441\u0435 random.Generator \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043d\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f permuted. <\/h3>\n<p>\u041e\u043d\u0430 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 <code>shuffle<\/code> \u0438 <code>permutation<\/code>. \u0421\u0442\u0430\u0440\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u043b\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u043a <img decoding=\"async\" class=\"formula inline\" source=\"1D \" alt=\"1D \" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5d2\/6ce\/a98\/5d26cea98f9f168107f088ff5ff9f48c.svg\"\/>\u043c\u0430\u0441\u0441\u0438\u0432 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0438 \u0435\u0433\u043e \u0442\u0430\u043a\u0436\u0435. \u041d\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>permuted<\/code> \u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b <img decoding=\"async\" class=\"formula inline\" source=\"2D\" alt=\"2D\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/06d\/543\/7b2\/06d5437b2fba7d528f02c73bc57ef567.svg\"\/> \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<h3>sliding_window_view \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0438\u0435 \u043e\u043a\u043d\u0430 \u0434\u043b\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 numpy<\/h3>\n<p>\u041e\u043a\u043e\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 &#8212; \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u043c\u0435\u0436\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u0430\u0432\u043d\u043e \u0432 \u043d\u0438\u0445 \u043d\u0443\u0436\u0434\u0430\u043b\u0438\u0441\u044c (\u0430 \u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0430\u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 &#8212; \u0441\u043c. <code>skimage.utils.view_as_windows()<\/code>). \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0433\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e. <\/p>\n<h3>\u041d\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f numpy.broadcast_shapes<\/h3>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>numpy.broadcast_shapes<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 &#8212; \u043a\u0430\u043a\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0444\u043e\u0440\u043c\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u043e\u0441\u043b\u0435 \u0431\u0440\u043e\u0430\u0434\u043a\u0430\u0441\u0442\u0438\u043d\u0433\u0430 \u0432\u0441\u0435\u0445 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c. <\/p>\n<pre><code class=\"python\">>>> np.broadcast_shapes((1, 2), (3, 1)) (3, 2)  >>> np.broadcast_shapes(2, (3, 1)) (3, 2)  >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) (5, 6, 7)<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0431\u0440\u043e\u0430\u0434\u043a\u0430\u0441\u0442\u0438\u043d\u0433 (broadcasting) \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/numpy.org\/doc\/1.20\/user\/basics.broadcasting.html#basics-broadcasting\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438 \u0433\u043e\u0432\u043e\u0440\u044f, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0430\u0437\u0438\u0442\u044c \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 \u043d\u0430 Github, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043c\u043d\u043e\u0433\u043e \u0437\u0430\u0431\u0430\u0432\u043d\u043e\u0433\u043e. \u0412\u043e\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aac\/cdb\/ec2\/aaccdbec2e99a20d9ac606d9aab2f4a4.png\" width=\"782\" height=\"343\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aac\/cdb\/ec2\/aaccdbec2e99a20d9ac606d9aab2f4a4.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0427\u0442\u043e \u0443\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0435?<\/h2>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c, \u0447\u0442\u043e \u0443\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0435 \u0438 is deprecated, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u0432 \u043d\u0430\u0440\u043e\u0434\u0435.<\/p>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u043b\u0438\u0430\u0441\u043e\u0432 \u0434\u043b\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 <\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0443\u0437\u043e\u0432 \u0443 \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0430\u043b\u0438\u0430\u0441\u044b \u0434\u043b\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>np.int<\/code> \u0438<code>int<\/code> \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u043f\u0435\u043d\u0441\u0438\u044e. \u0412\u043e\u0442 \u043f\u043e\u043b\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438: <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f74\/1c8\/e56\/f741c8e56117ab2655e40cf077c0630f.png\" width=\"816\" height=\"465\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f74\/1c8\/e56\/f741c8e56117ab2655e40cf077c0630f.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u0412\u044b\u0437\u043e\u0432 numpy.dual<\/h3>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <code>numpy.dual<\/code> \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043d\u0430 \u043f\u0435\u043d\u0441\u0438\u044e. \u0412\u043c\u0435\u0441\u0442\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0437 \u043d\u0435\u0433\u043e, \u0438\u0445 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 numpy \u0438 scipy. <\/p>\n<h3>\u0424\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/h3>\n<p>\u0424\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u0431\u0440\u0430\u043b\u0438 \u0438\u0437 Numpy 1.20. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <code>numpy_financial<\/code>: <code>fv, ipmt, irr, mirr, nper, npv, pmt, ppmt, pv, rate<\/code>.<\/p>\n<h2>\u041d\u043e\u0432\u044b\u0435 \u0444\u0438\u0447\u0438<\/h2>\n<h3>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 where \u0434\u043b\u044f all \u0438 any<\/h3>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>where<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0432 <code>all<\/code> \u0438 <code>any<\/code>. <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <\/p>\n<pre><code class=\"python\">>>> np.all([[True, True], [False, True]]) False  >>> np.all([[True, True], [False, True]], where=[[True], [False]]) True<\/code><\/pre>\n<h3>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 where \u0434\u043b\u044f mean, str, var<\/h3>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u0441\u043b\u0443\u0447\u0430\u044e, \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <code>mean, std, var<\/code> \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>where<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0438 \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <\/p>\n<pre><code class=\"python\">>>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]])  >>> np.mean(a)   12.0   >>> np.mean(a, where=[[True], [False], [False]])   9.0<\/code><\/pre>\n<h2>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/h2>\n<h4>np.linspace \u0441 \u0446\u0435\u043b\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 floor<\/h4>\n<p>\u0420\u0430\u043d\u044c\u0448\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f np.linspace \u0441 \u0446\u0435\u043b\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 (int), \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u0434\u0440\u043e\u0431\u0435\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u043b\u044f, \u0447\u0442\u043e \u0432\u043b\u0438\u044f\u043b\u043e \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438: <\/p>\n<pre><code class=\"python\">>>> np.linspace(-3, 1, 8, dtype=int) array([-3, -2, -1, -1,  0,  0,  0,  1])<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e <img decoding=\"async\" class=\"formula inline\" source=\"-\\infty\" alt=\"-\\infty\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6f3\/7fb\/6ed\/6f37fb6ed88f930104a94719143b4751.svg\"\/>, \u0447\u0442\u043e \u0434\u0430\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: <\/p>\n<pre><code class=\"python\">>>> np.linspace(-3, 1, 8, dtype=int) array([-3, -3, -2, -2, -1, -1,  0,  1])<\/code><\/pre>\n<h2>\u042d\u043f\u0438\u043b\u043e\u0433<\/h2>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c <a href=\"https:\/\/numpy.org\/doc\/1.20\/release\/1.20.0-notes.html#where-keyword-argument-for-numpy-all-and-numpy-any-functions\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043b\u0438\u0437\u0435<\/a>. \u0418 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u043e\u0433\u0443\u043b\u044f\u0442\u044c \u043f\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438 Github, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0438\u0437 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u041d\u0443, \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 &#8212; \u0432\u0434\u0440\u0443\u0433 \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \ud83d\ude42 <\/p>\n<\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438 \u0433\u043e\u0432\u043e\u0440\u044f, \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 Numpy \u0434\u043e \u0432\u0435\u0440\u0441\u0438\u0438 1.20 \u0432\u044b\u0437\u0432\u0430\u043b\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430. \u041a\u0442\u043e-\u0442\u043e \u0443\u0436\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0441\u044f \u0441 \u0442\u0430\u043a\u0438\u043c? \u041f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u043c\u0435\u043d\u044f\u0435\u043c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u0443. \u041d\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u044f\u0442, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0442\u0430\u043a\u0438\u0435 \u043a\u0440\u0443\u043f\u043d\u044b\u0435. <\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/540384\/\"> https:\/\/habr.com\/ru\/articles\/540384\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0414\u0440\u0443\u0437\u044c\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u044b\u0448\u0435\u043b \u043d\u043e\u0432\u044b\u0439 \u0440\u0435\u043b\u0438\u0437 Numpy 1.20.0 \u0438 \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c, \u0447\u0442\u043e \u0442\u0443\u0434\u0430 \u0437\u0430\u0432\u0435\u0437\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e. <\/p>\n<p>\u0421\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439, \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u043d\u0435 \u0432\u0441\u0435 &#8212; \u0438\u043d\u0430\u0447\u0435 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441 \u0433\u043e\u043b\u043e\u0432\u043e\u0439 \u043f\u043e\u0433\u0440\u044f\u0437\u043d\u0435\u043c \u0432 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438 \u0434\u043e\u043a\u0438. \u041f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 (\u043d\u0430 \u043d\u0430\u0448 \u0441\u043a\u0440\u043e\u043c\u043d\u044b\u0439 \u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434). \u0415\u0441\u043b\u0438 \u0412\u044b \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0435 \u0435\u0449\u0435 \u0447\u0442\u043e-\u0442\u043e \u0432\u0430\u0436\u043d\u043e\u0435, \u043e \u0447\u0435\u043c \u043c\u044b \u043d\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b\u0438 &#8212; \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445! <\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c. <\/p>\n<h2>\u041d\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/h2>\n<h3>\u0412 \u043a\u043b\u0430\u0441\u0441\u0435 random.Generator \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043d\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f permuted. <\/h3>\n<p>\u041e\u043d\u0430 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 <code>shuffle<\/code> \u0438 <code>permutation<\/code>. \u0421\u0442\u0430\u0440\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u043b\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u043a \u043c\u0430\u0441\u0441\u0438\u0432 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0438 \u0435\u0433\u043e \u0442\u0430\u043a\u0436\u0435. \u041d\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>permuted<\/code> \u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b  \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<h3>sliding_window_view \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0438\u0435 \u043e\u043a\u043d\u0430 \u0434\u043b\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 numpy<\/h3>\n<p>\u041e\u043a\u043e\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 &#8212; \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u043c\u0435\u0436\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u0430\u0432\u043d\u043e \u0432 \u043d\u0438\u0445 \u043d\u0443\u0436\u0434\u0430\u043b\u0438\u0441\u044c (\u0430 \u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0430\u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 &#8212; \u0441\u043c. <code>skimage.utils.view_as_windows()<\/code>). \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0433\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e. <\/p>\n<h3>\u041d\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f numpy.broadcast_shapes<\/h3>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>numpy.broadcast_shapes<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 &#8212; \u043a\u0430\u043a\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0444\u043e\u0440\u043c\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u043e\u0441\u043b\u0435 \u0431\u0440\u043e\u0430\u0434\u043a\u0430\u0441\u0442\u0438\u043d\u0433\u0430 \u0432\u0441\u0435\u0445 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c. <\/p>\n<pre><code class=\"python\">>>> np.broadcast_shapes((1, 2), (3, 1)) (3, 2)  >>> np.broadcast_shapes(2, (3, 1)) (3, 2)  >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7)) (5, 6, 7)<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0431\u0440\u043e\u0430\u0434\u043a\u0430\u0441\u0442\u0438\u043d\u0433 (broadcasting) \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/numpy.org\/doc\/1.20\/user\/basics.broadcasting.html#basics-broadcasting\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438 \u0433\u043e\u0432\u043e\u0440\u044f, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0430\u0437\u0438\u0442\u044c \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 \u043d\u0430 Github, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043c\u043d\u043e\u0433\u043e \u0437\u0430\u0431\u0430\u0432\u043d\u043e\u0433\u043e. \u0412\u043e\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0427\u0442\u043e \u0443\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0435?<\/h2>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c, \u0447\u0442\u043e \u0443\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0435 \u0438 is deprecated, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u0432 \u043d\u0430\u0440\u043e\u0434\u0435.<\/p>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u043b\u0438\u0430\u0441\u043e\u0432 \u0434\u043b\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 <\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0443\u0437\u043e\u0432 \u0443 \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0430\u043b\u0438\u0430\u0441\u044b \u0434\u043b\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>np.int<\/code> \u0438<code>int<\/code> \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u043f\u0435\u043d\u0441\u0438\u044e. \u0412\u043e\u0442 \u043f\u043e\u043b\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438: <\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h3>\u0412\u044b\u0437\u043e\u0432 numpy.dual<\/h3>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <code>numpy.dual<\/code> \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043d\u0430 \u043f\u0435\u043d\u0441\u0438\u044e. \u0412\u043c\u0435\u0441\u0442\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0437 \u043d\u0435\u0433\u043e, \u0438\u0445 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 numpy \u0438 scipy. <\/p>\n<h3>\u0424\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/h3>\n<p>\u0424\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u0431\u0440\u0430\u043b\u0438 \u0438\u0437 Numpy 1.20. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <code>numpy_financial<\/code>: <code>fv, ipmt, irr, mirr, nper, npv, pmt, ppmt, pv, rate<\/code>.<\/p>\n<h2>\u041d\u043e\u0432\u044b\u0435 \u0444\u0438\u0447\u0438<\/h2>\n<h3>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 where \u0434\u043b\u044f all \u0438 any<\/h3>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>where<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0432 <code>all<\/code> \u0438 <code>any<\/code>. <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <\/p>\n<pre><code class=\"python\">>>> np.all([[True, True], [False, True]]) False  >>> np.all([[True, True], [False, True]], where=[[True], [False]]) True<\/code><\/pre>\n<h3>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 where \u0434\u043b\u044f mean, str, var<\/h3>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u0441\u043b\u0443\u0447\u0430\u044e, \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <code>mean, std, var<\/code> \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>where<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0438 \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <\/p>\n<pre><code class=\"python\">>>> a = np.array([[5, 9, 13], [14, 10, 12], [11, 15, 19]])  >>> np.mean(a)   12.0   >>> np.mean(a, where=[[True], [False], [False]])   9.0<\/code><\/pre>\n<h2>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/h2>\n<h4>np.linspace \u0441 \u0446\u0435\u043b\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 floor<\/h4>\n<p>\u0420\u0430\u043d\u044c\u0448\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f np.linspace \u0441 \u0446\u0435\u043b\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 (int), \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u0434\u0440\u043e\u0431\u0435\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u043b\u044f, \u0447\u0442\u043e \u0432\u043b\u0438\u044f\u043b\u043e \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438: <\/p>\n<pre><code class=\"python\">>>> np.linspace(-3, 1, 8, dtype=int) array([-3, -2, -1, -1,  0,  0,  0,  1])<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e , \u0447\u0442\u043e \u0434\u0430\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: <\/p>\n<pre><code class=\"python\">>>> np.linspace(-3, 1, 8, dtype=int) array([-3, -3, -2, -2, -1, -1,  0,  1])<\/code><\/pre>\n<h2>\u042d\u043f\u0438\u043b\u043e\u0433<\/h2>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c <a href=\"https:\/\/numpy.org\/doc\/1.20\/release\/1.20.0-notes.html#where-keyword-argument-for-numpy-all-and-numpy-any-functions\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043b\u0438\u0437\u0435<\/a>. \u0418 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u043e\u0433\u0443\u043b\u044f\u0442\u044c \u043f\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438 Github, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0438\u0437 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u041d\u0443, \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 &#8212; \u0432\u0434\u0440\u0443\u0433 \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \ud83d\ude42 <\/p>\n<\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438 \u0433\u043e\u0432\u043e\u0440\u044f, \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 Numpy \u0434\u043e \u0432\u0435\u0440\u0441\u0438\u0438 1.20 \u0432\u044b\u0437\u0432\u0430\u043b\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430. \u041a\u0442\u043e-\u0442\u043e \u0443\u0436\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0441\u044f \u0441 \u0442\u0430\u043a\u0438\u043c? \u041f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u043c\u0435\u043d\u044f\u0435\u043c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u0443. \u041d\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u044f\u0442, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0442\u0430\u043a\u0438\u0435 \u043a\u0440\u0443\u043f\u043d\u044b\u0435. <\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/540384\/\"> https:\/\/habr.com\/ru\/articles\/540384\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-383041","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/383041","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=383041"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/383041\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=383041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=383041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=383041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}