{"id":297617,"date":"2020-01-24T09:00:21","date_gmt":"2020-01-24T09:00:21","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=297617"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2020-01-24T09:00:21","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=297617","title":{"rendered":"\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 Jupyter Notebooks \u043a\u0440\u0430\u0441\u043e\u0442\u0443 \u0438 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c"},"content":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/485318\/\">\u041c\u043d\u043e\u0433\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 Jupyter Notebooks. \u041d\u043e \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0412 \u0431\u043b\u043e\u043a\u043d\u043e\u0442\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u044f\u0447\u0435\u0439\u043a\u0438 \u0441 \u043a\u0440\u0430\u0441\u043d\u044b\u043c\u0438 \u043f\u043e\u043c\u0435\u0442\u043a\u0430\u043c\u0438 \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u0435\u0431\u044f \u00ab\u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0443\u043a\u0430\u0436\u0438 \u0447\u0438\u0441\u043b\u043e&#8230;\u00bb \u0438\u043b\u0438 \u00ab\u0437\u0430\u0434\u0430\u0439 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437&#8230;\u00bb. \u041a\u0430\u043a\u043e\u0439-\u0442\u043e \u043e\u0442\u043a\u0430\u0442 \u043a \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u0414\u0430 \u0438 \u0432\u044b\u0432\u043e\u0434 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0432\u044b\u043a \u043a \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c, \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430\u043c \u0438 \u043f\u0440\u043e\u0447\u0438\u043c \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043f\u043b\u043e\u0449\u0430\u0434\u044f\u043c \u0433\u043e\u0440\u043e\u0434\u043e\u0432 \u0438 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u0438\u044f. \u0412\u044b\u0432\u0435\u0434\u0435\u043c \u0438\u0445 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0432 \u00ab\u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435\u00bb  <\/p>\n<pre><code class=\"python\">tabledata = [[&quot;\u041c\u043e\u0441\u043a\u0432\u0430&quot;, 2561, 12615882],          [&quot;\u0421\u0430\u043d\u043a\u0442-\u041f\u0435\u0442\u0435\u0440\u0431\u0443\u0440\u0433&quot;, 1439, 5383890],          [&quot;\u042f\u0440\u043e\u0441\u043b\u0430\u0432\u043b\u044c&quot;, 205, 609828],          [&quot;\u0425\u0430\u0431\u0430\u0440\u043e\u0432\u0441\u043a&quot;, 383, 1321473]] tabledata<\/code><\/pre>\n<p>  \u0412\u0438\u0434\u0438\u043c \u0432 \u0431\u043b\u043e\u043a\u043d\u043e\u0442\u0435<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gm\/ds\/oj\/gmdsojz79feeecv8me2_sxgckt0.jpeg\" alt=\"image\"><\/p>\n<p>  \u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c\u0443, \u0438\u0437\u0431\u0430\u043b\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u0442\u0430\u043a\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f. \u041d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u043c\u0443 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u043e\u043c\u0443 \u0432\u0438\u0434\u0443.<\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0438\u0440\u043e\u043a\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 pandas  <\/p>\n<pre><code class=\"python\">import pandas as pd pd.DataFrame(tabledata, columns=[&quot;\u0413\u043e\u0440\u043e\u0434&quot;,&quot;\u041f\u043b\u043e\u0449\u0430\u0434\u044c (\u043a\u0432. \u043a\u043c)&quot;, &quot;\u041d\u0430\u0441\u0435\u043b\u0435\u043d\u0438\u0435 (\u0447\u0435\u043b\u043e\u0432\u0435\u043a)&quot;])<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yx\/pl\/f1\/yxplf1muoddh0q_opcidyywe-xo.jpeg\" alt=\"image\"><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u043e \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 pandas \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442, \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0438\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e. <br \/>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0434\u043d\u0443 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u2014 tabulate (https:\/\/pypi.org\/project\/tabulate\/)<br \/>  \u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 <b>pip install tabulate<\/b>  <\/p>\n<pre><code class=\"python\">from IPython.display import HTML, display from tabulate import tabulate  display(HTML(tabulate(tabledata, tablefmt='html')))<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/k3\/rh\/eb\/k3rhebyp4-s75dnxgpvtzzpx5hi.jpeg\" alt=\"image\"><br \/>  \u041c\u043e\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u00ab\u043f\u0441\u0435\u0432\u0434\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u00bb \u0432\u0438\u0434\u0435.  <\/p>\n<pre><code class=\"python\">print(tabulate(tabledata))<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/7o\/a1\/7a\/7oa17avuxtjxzfwn4_jnkbycmgq.jpeg\"><br \/>  \u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438  <\/p>\n<pre><code class=\"python\">print(tabulate(tabledata, headers=[&quot;\u0413\u043e\u0440\u043e\u0434&quot;,&quot;\u041f\u043b\u043e\u0449\u0430\u0434\u044c (\u043a\u0432. \u043a\u043c)&quot;, &quot;\u041d\u0430\u0441\u0435\u043b\u0435\u043d\u0438\u0435 (\u0447\u0435\u043b\u043e\u0432\u0435\u043a)&quot;]))<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xk\/g_\/ob\/xkg_obder3vl8jcmmnz0nlgpoji.jpeg\"><br \/>  \u0418 \u0438\u043d\u0434\u0435\u043a\u0441\u044b  <\/p>\n<pre><code class=\"python\">display(HTML(tabulate(tabledata, headers=[&quot;\u0413\u043e\u0440\u043e\u0434&quot;,&quot;\u041f\u043b\u043e\u0449\u0430\u0434\u044c (\u043a\u0432. \u043a\u043c)&quot;, &quot;\u041d\u0430\u0441\u0435\u043b\u0435\u043d\u0438\u0435 (\u0447\u0435\u043b\u043e\u0432\u0435\u043a)&quot;], tablefmt='html', showindex=&quot;always&quot;)))<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ac\/bj\/56\/acbj568ccrkf1nru5x5ohuojkd0.jpeg\"><br \/>  tabulate \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043a\u0430\u043a \u0438 pandas<\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0442\u043e\u043c \u043e\u0431\u0440\u0430\u0441\u0442\u0451\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438.  <\/p>\n<pre><code class=\"python\">from IPython.display import HTML, display  def dataToTable(data, columns = None):     if len(data) == 0 :           display(HTML('&lt;b&gt;\u041d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445&lt;\/b&gt;'))         return          hdr = ''     if columns != None:         for col in columns: # \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b             hdr = hdr + '&lt;th&gt;' + col + '&lt;\/th&gt;'                      hdr = '&lt;tr&gt;' + hdr + '&lt;\/tr&gt;'      dt = ''     for row in data: # \u041f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u0446\u0438\u043a\u043b\u043e\u043c \u043f\u043e \u0432\u0441\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0430\u043c         dt = dt + '&lt;tr&gt;'         for cell in row: # \u0418 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0442\u0435\u043b\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u044b             dt = dt + '&lt;td&gt;' + str(cell) + '&lt;\/td&gt;'         dt = dt + '&lt;\/tr&gt;'                  display(HTML('&lt;table&gt;' + hdr + dt + '&lt;\/table&gt;')) # \u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d  dataToTable(tabledata, columns=[&quot;\u0413\u043e\u0440\u043e\u0434&quot;,&quot;\u041f\u043b\u043e\u0449\u0430\u0434\u044c (\u043a\u0432. \u043a\u043c)&quot;, &quot;\u041d\u0430\u0441\u0435\u043b\u0435\u043d\u0438\u0435 (\u0447\u0435\u043b\u043e\u0432\u0435\u043a)&quot;])<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xk\/g_\/ob\/xkg_obder3vl8jcmmnz0nlgpoji.jpeg\"><\/p>\n<h2>\u0412\u044b\u0432\u043e\u0434 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/h2>\n<p>  \u041c\u044b \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u043a \u043f\u0438\u043a\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c \u0438 \u0438\u043a\u043e\u043d\u043a\u0430\u043c. \u0414\u0430\u0436\u0435 \u0432 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0435 \u043f\u043e\u0433\u043e\u0434\u044b \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0441 \u0441\u043e\u043b\u043d\u044b\u0448\u043a\u0430\u043c\u0438 \u0438 \u0442\u0443\u0447\u043a\u0430\u043c\u0438. \u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u043d\u0430\u0448\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 IPython. \u0415\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f Image \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 (PNG\/JPEG\/GIF), \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u043a\u0430\u043a \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u0442\u0430\u043a \u0438 \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445. \u0417\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u044b.<\/p>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0437\u0434\u0435\u0441\u044c <a href=\"https:\/\/ipython.readthedocs.io\/en\/stable\/api\/generated\/IPython.display.html?highlight=display#IPython.display.Image\" rel=\"nofollow\">ipython.readthedocs.io\/en\/stable\/api\/generated\/IPython.display.html?highlight=display#IPython.display.Image<\/a>  <\/p>\n<pre><code class=\"python\">from IPython.display import Image # \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a  display(Image(url='https:\/\/habrastorage.org\/webt\/9m\/2c\/zd\/9m2czdt-uv7oe6v-nws3frtw7-a.jpeg',                width = 200) # \u0417\u0430\u0434\u0430\u0435\u043c \u0448\u0438\u0440\u0438\u043d\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438        )  # display(Image(filename='Python_royal_35.JPG', width = 200)) # \u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b<\/code><\/pre>\n<p>  \u041b\u044e\u0431\u0443\u0435\u043c\u0441\u044f \u043f\u0438\u0442\u043e\u043d\u043e\u043c<br \/>  <img decoding=\"async\" width=\"200\" src=\"https:\/\/habrastorage.org\/webt\/9m\/2c\/zd\/9m2czdt-uv7oe6v-nws3frtw7-a.jpeg\" alt=\"image\"><\/p>\n<h2>\u0423\u043a\u0440\u0430\u0448\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442<\/h2>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c HTML \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u0441\u0435 \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438  <\/p>\n<pre><code class=\"python\">from IPython.core.display import display, HTML display(HTML(&quot;&lt;font color='green'&gt;\u041c\u043e\u0439 \u0437\u0435\u043b\u0435\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442&lt;\/font&gt;&quot;))<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/em\/yq\/qi\/emyqqidxicsdennitipsamqpbx8.jpeg\"><br \/>  \u0410 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 termcolor. \u041e\u043d\u0430 \u043f\u043e\u0437\u043c\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u044f\u0441\u044c \u0432 HTML \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0446\u0432\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u0444\u043e\u043d\u0430, \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0448\u0440\u0438\u0444\u0442\u0430. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0442\u0443\u0442 \u2014 <a href=\"https:\/\/pypi.org\/project\/termcolor\/\" rel=\"nofollow\">pypi.org\/project\/termcolor<\/a>  <\/p>\n<pre><code class=\"python\">from termcolor import colored # \u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 pip install termcolor print(colored(&quot;\u041a\u0440\u0430\u0441\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 (\u0431\u0435\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432)&quot;, &quot;red&quot;)) print(colored(&quot;\u041a\u0440\u0430\u0441\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 (\u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435)&quot;, &quot;red&quot;,  attrs=[&quot;underline&quot;])) print(colored(&quot;\u0417\u0435\u043b\u0435\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u043d\u0430 \u043a\u0440\u0430\u0441\u043d\u043e\u043c \u0444\u043e\u043d\u0435 (\u0431\u0435\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432)&quot;, &quot;green&quot;, &quot;on_red&quot; )) print(colored(&quot;\u0417\u0435\u043b\u0435\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u043d\u0430 \u043a\u0440\u0430\u0441\u043d\u043e\u043c \u0444\u043e\u043d\u0435 (bold)&quot;, &quot;green&quot;, &quot;on_red&quot;, attrs=[&quot;bold&quot;]))<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kg\/kf\/gt\/kgkfgtasmbfutlqiuohoioftjmk.jpeg\">  <\/p>\n<h2>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>  \u041d\u0438\u043a\u043e\u043c\u0443 \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0445\u043e\u0434\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044f \u043a\u0430\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0443\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/pm\/z-\/1o\/pmz-1o0ehm9uvdyjbobsg2llyla.jpeg\"><br \/>  \u0412\u0438\u0434\u0435\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u2014 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u0438\u044f\u0442\u043d\u0435\u0435 (\u0434\u0430-\u0434\u0430, \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u00ab\u0447\u0435\u0440\u0432\u044f\u043a\u0430\u00bb \u043c\u043e\u0436\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f)<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/om\/eh\/o3\/omeho3yd38s4_m93s76rmh0oq1s.png\"><br \/>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0442\u0443\u0442 \u2014 <a href=\"https:\/\/ipywidgets.readthedocs.io\" rel=\"nofollow\">ipywidgets.readthedocs.io<\/a><\/p>\n<p>  \u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/p>\n<p>  pip install ipywidgets<br \/>  jupyter nbextension enable &#8212;py widgetsnbextension  <\/p>\n<pre><code class=\"python\">from ipywidgets import IntProgress from IPython.display import display import time  prgBar = IntProgress(min = 0, max = 100) # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0431\u0430\u0440 display(prgBar) # \u0412\u044b\u0432\u043e\u0434\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0431\u0430\u0440 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d  while prgBar.value &lt; prgBar.max:   # \u041f\u043e\u043a\u0430 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0434\u043e\u0448\u043b\u043e \u0434\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0430 - \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0446\u0438\u043a\u043b     prgBar.value = prgBar.value + 1 # \u0414\u0432\u0438\u0433\u0430\u0435\u043c &quot;\u043f\u043e\u043b\u043e\u0441\u043a\u0443&quot;     time.sleep(0.1)      print('\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d')<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/nj\/5c\/ks\/nj5cksfkjfd5itwjc4qyykt9f78.jpeg\">  <\/p>\n<h2>\u0418\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c<\/h2>\n<p>  \u0422\u0430 \u0436\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 ipywidgets \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c, \u043d\u043e \u0438 \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e.<\/p>\n<p>  \u0421\u0430\u043c\u044b\u0439, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u2014 \u044d\u0442\u043e \u0440\u0435\u0430\u043a\u0446\u0438\u044f \u043d\u0430 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 ipywidgets \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0443 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 (\u0442\u0435\u043a\u0441\u0442\u043e\u043c, \u0441\u0442\u0438\u043b\u0435\u043c \u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c\u0438) \u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0435\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f.  <\/p>\n<pre><code class=\"python\">from IPython.display import display from ipywidgets import Button   # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 button1 = Button(description=&quot;\u041d\u0430\u0436\u043c\u0438 \u043c\u0435\u043d\u044f!&quot;,                          button_style='success' # 'success', 'info', 'warning', 'danger', ''                         )  def on_button_clicked(b): # \u041e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f     print(&quot;\u041a\u043b\u0438\u043a&quot;)  button1.on_click(on_button_clicked) # \u041d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u044d\u0442\u043e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 &quot;on_click&quot;  display(button1) # \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/in\/dj\/xj\/indjxjrqvwfw1gfhmsivctd0ps8.jpeg\"><br \/>  \u0420\u0430\u0437\u043c\u0435\u0440 \u043a\u043d\u043e\u043f\u043a\u0438 \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 layout<\/p>\n<pre><code class=\"python\">from IPython.display import display from ipywidgets import Button, Layout  button2 = Button(description='\u041a\u043d\u043e\u043f\u043a\u0430 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c\u0438', button_style='success',            layout=Layout(width='50%', height='80px')) display(button2)<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/if\/ro\/du\/ifroduzso2pydg8exrd2sl9aruy.jpeg\"><br \/>  \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0447\u0438\u0441\u0435\u043b \u0438 \u0434\u0430\u0442 \u0435\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b FloatSlider \u0438 DatePicker.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e &lt;\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442&gt;.value<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043e\u0442\u043b\u043e\u0432\u0438\u0442\u044c \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 observe<\/p>\n<pre><code class=\"python\">from IPython.display import display from ipywidgets import FloatSlider  fSlider = FloatSlider(     value=7.5, # \u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435     min=0,     # \u041c\u0438\u043d\u0438\u043c\u0443\u043c     max=10.0,  # \u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c     step=0.1,  # \u0428\u0430\u0433 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f     description='\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440:',     continuous_update=False,  # True - \u0441\u043e\u0431\u044b\u0442\u0438\u0435 observe \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f     orientation='horizontal'  # \u0413\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043b\u0438 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 )  def on_value_change(b):     print(b['old'], '-&gt;', b['new'])  fSlider.observe(on_value_change, names='value') display(fSlider)<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/6f\/0y\/cu\/6f0ycuho1upg3bis7ni2orccnbu.jpeg\"><br \/>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0442\u0435\u043a\u0443\u0449\u0435\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e:,  <\/p>\n<pre><code class=\"python\">fSlider.value<\/code><\/pre>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c: <\/p>\n<pre><code class=\"python\">from IPython.display import display from ipywidgets import DatePicker  dPicker = DatePicker(     description='\u0414\u0430\u0442\u0430:' )  def on_button_clicked(b):     print(b['old'], '-&gt;', b['new'])  dPicker.observe(on_button_clicked, names='value') display(dPicker)<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fl\/cd\/4r\/flcd4rjdhgsamm4y7lwbuon1qnq.jpeg\"><br \/>  \u0414\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0435\u0441\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a RadioButtons, \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a Dropdown \u0438 \u0433\u0440\u0443\u043f\u043f\u0430 \u043a\u043d\u043e\u043f\u043e\u043a ToggleButtons. value \u0438 observe \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435.<\/p>\n<p>  \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0432 \u0432\u0438\u0434\u0435 \u043f\u0435\u0440\u0435\u0447\u043d\u044f \u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d, \u0442\u0430\u043a \u0438 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439.<\/p>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<pre><code class=\"python\">from IPython.display import display from ipywidgets import RadioButtons  rButtons1 = RadioButtons(     options=['\u041a\u0440\u0430\u0441\u043d\u044b\u0439', '\u0416\u0435\u043b\u0442\u044b\u0439', '\u0417\u0435\u043b\u0435\u043d\u044b\u0439'],     value='\u0416\u0435\u043b\u0442\u044b\u0439', # \u0412\u044b\u0431\u043e\u0440 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e     description='\u0426\u0432\u0435\u0442:' )   def on_button_clicked(b):     print(b['old'], '-&gt;', b['new'])  rButtons1.observe(on_button_clicked, names='value') display(rButtons1)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/l1\/_u\/b5\/l1_ub5iax-5xfamatf6bfh3qe6y.jpeg\">\u0412\u044b\u0432\u0435\u0434\u0435\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <\/p>\n<pre><code class=\"python\">rButtons1.value<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c rButtons1.value \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430.<\/p>\n<p>  \u041f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439:<\/p>\n<pre><code class=\"python\">from IPython.display import display from ipywidgets import RadioButtons  rButtons2 = RadioButtons(     options=[('\u041a\u0440\u0430\u0441\u043d\u044b\u0439', 1), ('\u0416\u0435\u043b\u0442\u044b\u0439', 2), ('\u0417\u0435\u043b\u0435\u043d\u044b\u0439', 3)],     value=2, # \u0412\u044b\u0431\u043e\u0440 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e     description='\u0426\u0432\u0435\u0442:'  )  def on_button_clicked(b):     print(b['old'], '-&gt;', b['new'])  rButtons2.observe(on_button_clicked, names='value') display(rButtons2)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mv\/kg\/pt\/mvkgpton0y6sh4cnzo_p2dcdfcm.jpeg\">\u0412 \u044d\u0442\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c rButtons2.value \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u043e, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e.<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a (Dropdown)<\/p>\n<pre><code class=\"python\">from IPython.display import display from ipywidgets import Dropdown  dropdown1 = Dropdown(     options=[('\u041a\u0440\u0430\u0441\u043d\u044b\u0439', 1), ('\u0416\u0435\u043b\u0442\u044b\u0439', 2), ('\u0417\u0435\u043b\u0435\u043d\u044b\u0439', 3)],     value=2, # \u0412\u044b\u0431\u043e\u0440 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e     description='\u0426\u0432\u0435\u0442:'  )  def on_button_clicked(b):     print(b['old'], '-&gt;', b['new'])  dropdown1.observe(on_button_clicked, names='value') display(dropdown1)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fj\/y-\/cu\/fjy-cu81pneppzaqkcumxsky79c.jpeg\"><br \/>  \u0414\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Checkbox \u0438 ToggleButton. \u0423 \u043d\u0438\u0445 \u0435\u0441\u0442\u044c \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0435 \u043d\u0430\u043c value \u0438 observe.<\/p>\n<pre><code class=\"python\">from IPython.display import display from ipywidgets import Checkbox  cb1 = Checkbox(     value=False,     description='\u0421\u043e\u0433\u043b\u0430\u0441\u0435\u043d'  )  def on_button_clicked(b):     print(cb1.value)  cb1.observe(on_button_clicked, names='value') display(cb1)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fs\/xd\/vz\/fsxdvzh2pilbgroylp58voa-lk4.jpeg\"><\/p>\n<pre><code class=\"python\">from IPython.display import display from ipywidgets import ToggleButton  tb1 = ToggleButton(     value=False,     description='\u041d\u0435 \u043d\u0430\u0436\u0430\u0442\u0430',     disabled=False,     button_style='success', # 'success', 'info', 'warning', 'danger' or ''     tooltip='\u041f\u0440\u0438\u043d\u044f\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f',     icon='check' ) tb2 = ToggleButton(     value=True,     description='\u0410 \u044d\u0442\u0430 \u043d\u0430\u0436\u0430\u0442\u0430',     disabled=False,     button_style='success', # 'success', 'info', 'warning', 'danger' or ''     tooltip='\u041f\u0440\u0438\u043d\u044f\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f',     icon='check' )  display(tb1, tb2)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/m6\/hk\/0u\/m6hk0uunvgny-h64fxsvepkjbvg.jpeg\">\u0414\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u043b\u0443\u0436\u0435\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 Textarea<\/p>\n<pre><code class=\"python\">from IPython.display import display from ipywidgets import Textarea, Layout  Textarea1 = Textarea(     value='\u041f\u0440\u0438\u0432\u0435\u0442, Habr!',     placeholder='\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0442\u0435\u043a\u0441\u0442',     description='\u0422\u0435\u043a\u0441\u0442:',     layout=Layout(width='600px', height='100px') )  display(Textarea1)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/-7\/qi\/1i\/-7qi1i4wi5slolwelmywxpyibyo.jpeg\">  <\/p>\n<h2>\u0418\u0418 (\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043d\u044b\u0435 \u0438\u0437\u044b\u0441\u043a\u0438)<\/h2>\n<p>\u041a\u043e\u0433\u0434\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e, \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u0439\u0442\u0438 \u043f\u043e \u043f\u0443\u0442\u0438 \u0434\u0435\u0441\u043a\u0442\u043e\u043f\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043e\u0431\u043e\u0441\u043e\u0431\u043b\u0435\u043d\u043d\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u044f\u0442\u0441\u044f Accordion \u0438 Tab.<\/p>\n<pre><code class=\"python\">from IPython.display import display from ipywidgets import Accordion, IntSlider, Text  accordion = Accordion(children=[IntSlider(value=42), Text(value='\u0421\u043e\u0440\u043e\u043a \u0434\u0432\u0430')]) accordion.set_title(0, '\u0420\u0430\u0437\u0434\u0435\u043b 1') accordion.set_title(1, '\u0420\u0430\u0437\u0434\u0435\u043b 2') display(accordion)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/nx\/7o\/r5\/nx7or5apcafwwecsqsztwkokuc4.jpeg\"><\/p>\n<pre><code class=\"python\">from IPython.display import display from ipywidgets import Tab, IntSlider, Text  tab = Tab() tab.children = [IntSlider(value=42), Text(value='\u0421\u043e\u0440\u043e\u043a \u0434\u0432\u0430')] tab.set_title(0, '\u0420\u0430\u0437\u0434\u0435\u043b 1') tab.set_title(1, '\u0420\u0430\u0437\u0434\u0435\u043b 2')  display(tab)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xy\/cl\/oc\/xyclocdakpaa5hsr9efzthaa4pu.jpeg\"><br \/>  \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 ipywidgets \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043b. \u0412 \u043d\u0435\u0439 \u0435\u0449\u0435 \u043c\u0430\u0441\u0441\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 Jupyter Notebooks \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438.<\/p>\n<p>  \u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0443\u0442 <a href=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/examples\/Widget%20List.html\" rel=\"nofollow\">ipywidgets.readthedocs.io\/en\/stable\/examples\/Widget%20List.html<\/a><\/div>\n<p> \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\/post\/485318\/\"> https:\/\/habr.com\/ru\/post\/485318\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/485318\/\">\u041c\u043d\u043e\u0433\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 Jupyter Notebooks. \u041d\u043e \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0412 \u0431\u043b\u043e\u043a\u043d\u043e\u0442\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u044f\u0447\u0435\u0439\u043a\u0438 \u0441 \u043a\u0440\u0430\u0441\u043d\u044b\u043c\u0438 \u043f\u043e\u043c\u0435\u0442\u043a\u0430\u043c\u0438 \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u0435\u0431\u044f \u00ab\u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0443\u043a\u0430\u0436\u0438 \u0447\u0438\u0441\u043b\u043e&#8230;\u00bb \u0438\u043b\u0438 \u00ab\u0437\u0430\u0434\u0430\u0439 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437&#8230;\u00bb. \u041a\u0430\u043a\u043e\u0439-\u0442\u043e \u043e\u0442\u043a\u0430\u0442 \u043a \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u0414\u0430 \u0438 \u0432\u044b\u0432\u043e\u0434 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0432\u044b\u043a \u043a \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c, \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430\u043c \u0438 \u043f\u0440\u043e\u0447\u0438\u043c \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.  <\/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-297617","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297617","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=297617"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297617\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=297617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=297617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=297617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}