{"id":303787,"date":"2020-05-18T15:00:22","date_gmt":"2020-05-18T15:00:22","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=303787"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=303787","title":{"rendered":"5 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c Data Story"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/502568\/\"><i><b>\u0421\u0442\u0430\u0442\u044c\u044f \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u0430 \u0432 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u0443\u0440\u0441\u0430 <a href=\"https:\/\/otus.pw\/mb8CI\/\">\u00ab\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a Python\u00bb<\/a>.<\/b><\/i><\/p>\n<hr>\n<p>  \u0421\u0442\u043e\u0440\u0438\u0442\u0435\u043b\u043b\u0438\u043d\u0433 \u2013 \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0445 \u043d\u0430\u0432\u044b\u043a\u043e\u0432 \u0434\u043b\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0442\u043e\u0431\u044b \u0434\u043e\u043d\u043e\u0441\u0438\u0442\u044c \u0438\u0434\u0435\u0438 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0443\u044e \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u044e. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 5 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0445\u043e\u0434\u044f\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u0438 \u043c\u043e\u0433\u0443\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0430\u0448\u0443 Data Story \u0431\u043e\u043b\u0435\u0435 \u044d\u0441\u0442\u0435\u0442\u0438\u0447\u043d\u043e\u0439 \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0439. \u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <a href=\"https:\/\/plotly.com\/python\/\">Plotly<\/a> \u043d\u0430 Python (\u043e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043d\u0430 R), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0443\u0441\u0438\u043b\u0438\u044f\u043c\u0438.<a name=\"habracut\"><\/a><\/p>\n<h3>\u0427\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u0432 Plotly<\/h3>\n<p>  \u0413\u0440\u0430\u0444\u0438\u043a\u0438 Plotly \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b: \u043e\u043d\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432 jupyter notebooks, \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442, \u0430 \u0435\u0449\u0435 \u043e\u043d\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u043c\u044b \u0441 <a href=\"https:\/\/plotly.com\/dash\/\">Dash<\/a> \u2014 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0430\u043d\u0435\u043b\u0435\u0439 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<h2>\u041d\u0430\u0447\u043d\u0435\u043c<\/h2>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0449\u0435 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 plotly, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b: <\/p>\n<pre><code class=\"python\">pip install plotly<\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c!<\/p>\n<h3>1. \u0410\u043d\u0438\u043c\u0430\u0446\u0438\u0438<\/h3>\n<p>  \u041d\u0430\u0448\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0447\u0430\u0441\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044e \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u0438. \u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u0432 plotly \u2013 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043e\u0442\u0440\u0430\u0437\u0438\u0442\u044c, \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u043a\u043e\u0434\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kd\/rj\/te\/kdrjtejsuebwwanvpppkbkbszdg.gif\"><\/p>\n<pre><code class=\"python\">import plotly.express as px from vega_datasets import data df = data.disasters() df = df[df.Year &gt; 1990] fig = px.bar(df,              y=&quot;Entity&quot;,              x=&quot;Deaths&quot;,              animation_frame=&quot;Year&quot;,              orientation='h',              range_x=[0, df.Deaths.max()],              color=&quot;Entity&quot;) # improve aesthetics (size, grids etc.) fig.update_layout(width=1000,                   height=800,                   xaxis_showgrid=False,                   yaxis_showgrid=False,                   paper_bgcolor='rgba(0,0,0,0)',                   plot_bgcolor='rgba(0,0,0,0)',                   title_text='Evolution of Natural Disasters',                   showlegend=False) fig.update_xaxes(title_text='Number of Deaths') fig.update_yaxes(title_text='') fig.show()<\/code><\/pre>\n<p>  \u041f\u043e\u0447\u0442\u0438 \u043b\u044e\u0431\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u043c\u043e\u0436\u043d\u043e \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041f\u0440\u0438\u043c\u0435\u0440 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b \u0440\u0430\u0441\u0441\u0435\u044f\u043d\u0438\u044f:<\/p>\n<pre><code class=\"python\">import plotly.express as px df = px.data.gapminder() fig = px.scatter(     df,     x=&quot;gdpPercap&quot;,     y=&quot;lifeExp&quot;,     animation_frame=&quot;year&quot;,     size=&quot;pop&quot;,     color=&quot;continent&quot;,     hover_name=&quot;country&quot;,     log_x=True,     size_max=55,     range_x=[100, 100000],     range_y=[25, 90],      #   color_continuous_scale=px.colors.sequential.Emrld ) fig.update_layout(width=1000,                   height=800,                   xaxis_showgrid=False,                   yaxis_showgrid=False,                   paper_bgcolor='rgba(0,0,0,0)',                   plot_bgcolor='rgba(0,0,0,0)')<\/code><\/pre>\n<h3>2. \u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b Sunburst<\/h3>\n<p>  \u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b Sunburst \u2013 \u044d\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 <i>group by<\/i>. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0438\u043c\u0435\u044e\u0449\u0438\u0439\u0441\u044f \u043e\u0431\u044a\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0434\u043d\u0443 \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c sunburst-\u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u043e\u0439.<br \/>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0447\u0430\u0435\u0432\u044b\u0445 \u043f\u043e \u043f\u043e\u043b\u0443 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a. \u0417\u043d\u0430\u0447\u0438\u0442, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c <i>group by<\/i> \u0434\u0432\u0430\u0436\u0434\u044b \u0438 \u0441 \u043b\u0435\u0433\u043a\u043e\u0441\u0442\u044c\u044e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043b\u0438\u0446\u0435\u0437\u0440\u0435\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ln\/wv\/wo\/lnwvwozw1mv5piywyphksgbi2m8.gif\"><\/p>\n<p>  \u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u043b\u0438\u043a\u0430\u0442\u044c \u043d\u0430 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u0443\u044e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0412\u0441\u0435, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u0438\u043c\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u043c\u0438, \u043f\u0440\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 (\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>parents<\/code> \u0432 \u043a\u043e\u0434\u0435) \u0438 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 <i>group by<\/i>.<\/p>\n<pre><code class=\"python\">import plotly.graph_objects as go import plotly.express as px import numpy as np import pandas as pd df = px.data.tips() fig = go.Figure(go.Sunburst(     labels=[&quot;Female&quot;, &quot;Male&quot;, &quot;Dinner&quot;, &quot;Lunch&quot;, 'Dinner ', 'Lunch '],     parents=[&quot;&quot;, &quot;&quot;, &quot;Female&quot;, &quot;Female&quot;, 'Male', 'Male'],     values=np.append(         df.groupby('sex').tip.mean().values,         df.groupby(['sex', 'time']).tip.mean().values),     marker=dict(colors=px.colors.sequential.Emrld)),                 layout=go.Layout(paper_bgcolor='rgba(0,0,0,0)',                                  plot_bgcolor='rgba(0,0,0,0)'))  fig.update_layout(margin=dict(t=0, l=0, r=0, b=0),                   title_text='Tipping Habbits Per Gender, Time and Day') fig.show()<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hg\/qa\/rd\/hgqard8bpmoiiil_jluba3dth2w.gif\"><\/p>\n<p>   \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0433\u043e <i>group by<\/i>, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0435\u0449\u0435 \u0442\u0440\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438.<\/p>\n<pre><code class=\"python\">import plotly.graph_objects as go import plotly.express as px import pandas as pd import numpy as np df = px.data.tips() fig = go.Figure(go.Sunburst(labels=[     &quot;Female&quot;, &quot;Male&quot;, &quot;Dinner&quot;, &quot;Lunch&quot;, 'Dinner ', 'Lunch ', 'Fri', 'Sat',     'Sun', 'Thu', 'Fri ', 'Thu ', 'Fri  ', 'Sat  ', 'Sun  ', 'Fri   ', 'Thu   ' ],                             parents=[                                 &quot;&quot;, &quot;&quot;, &quot;Female&quot;, &quot;Female&quot;, 'Male', 'Male',                                 'Dinner', 'Dinner', 'Dinner', 'Dinner',                                 'Lunch', 'Lunch', 'Dinner ', 'Dinner ',                                 'Dinner ', 'Lunch ', 'Lunch '                             ],                             values=np.append(                                 np.append(                                     df.groupby('sex').tip.mean().values,                                     df.groupby(['sex',                                                 'time']).tip.mean().values,                                 ),                                 df.groupby(['sex', 'time',                                             'day']).tip.mean().values),                             marker=dict(colors=px.colors.sequential.Emrld)),                 layout=go.Layout(paper_bgcolor='rgba(0,0,0,0)',                                  plot_bgcolor='rgba(0,0,0,0)')) fig.update_layout(margin=dict(t=0, l=0, r=0, b=0),                   title_text='Tipping Habbits Per Gender, Time and Day')  fig.show()<\/code><\/pre>\n<h3>3. \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438<\/h3>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u043c\u0438 \u2013 \u044d\u0442\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0442\u044c, \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0445\u043e\u0434\u0443, \u0447\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0439.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ht\/gs\/xs\/htgsxs4ls_bwpqm-yl61833cdmu.gif\"><\/p>\n<pre><code class=\"python\">import plotly.express as px from vega_datasets import data import pandas as pd df = data.movies() df = df.dropna() df['Genre_id'] = df.Major_Genre.factorize()[0] fig = px.parallel_categories(     df,     dimensions=['MPAA_Rating', 'Creative_Type', 'Major_Genre'],     color=&quot;Genre_id&quot;,     color_continuous_scale=px.colors.sequential.Emrld, ) fig.show()<\/code><\/pre>\n<h3>4. \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b<\/h3>\n<p>  \u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0441 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438 \u2013 \u044d\u0442\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0430. \u0417\u0434\u0435\u0441\u044c \u043a\u0430\u0436\u0434\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u043e\u0434\u043d\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435. \u042d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432 (\u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445), \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u0432, \u0442\u0440\u0435\u043d\u0434\u043e\u0432 \u0438 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0443 \u0434\u0432\u0443\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439, \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u043d\u0430 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043b\u0438\u043d\u0438\u0438, \u0447\u0442\u043e \u0443\u043a\u0430\u0436\u0435\u0442 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5q\/g9\/pj\/5qg9pjrh1asd5wel5f5y-3wporw.gif\"><\/p>\n<pre><code class=\"python\">import plotly.express as px from vega_datasets import data import pandas as pd df = data.movies() df = df.dropna() df['Genre_id'] = df.Major_Genre.factorize()[0] fig = px.parallel_coordinates(     df,     dimensions=[         'IMDB_Rating', 'IMDB_Votes', 'Production_Budget', 'Running_Time_min',         'US_Gross', 'Worldwide_Gross', 'US_DVD_Sales'     ],     color='IMDB_Rating',     color_continuous_scale=px.colors.sequential.Emrld) fig.show()<\/code><\/pre>\n<h3>5. \u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b-\u0434\u0430\u0442\u0447\u0438\u043a\u0438 \u0438 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u044b<\/h3>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ef\/iq\/hb\/efiqhbbcbrz-vcu4wh6ufedxini.png\"><\/p>\n<p>  \u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b-\u0434\u0430\u0442\u0447\u0438\u043a\u0438 \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u044d\u0441\u0442\u0435\u0442\u0438\u043a\u0438. \u041e\u043d\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u0445 \u0443\u0441\u043f\u0435\u0445\u0430 \u0438\u043b\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0438\u0445 \u0441 \u0432\u0430\u0448\u0435\u0439 \u0446\u0435\u043b\u044c\u044e.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fj\/iv\/uj\/fjivuj0o4u7bd2tnz6u13jbhtgi.png\"><\/p>\n<p>  \u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0431\u0438\u0437\u043d\u0435\u0441\u0430 \u0438 \u043a\u043e\u043d\u0441\u0430\u043b\u0442\u0438\u043d\u0433\u0430. \u041e\u043d\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u044b \u0442\u0435\u043a\u0441\u0442\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0438 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0440\u043e\u0441\u0442\u0430.<\/p>\n<pre><code class=\"python\">import plotly.graph_objects as go fig = go.Figure(go.Indicator(     domain = {'x': [0, 1], 'y': [0, 1]},     value = 4.3,     mode = &quot;gauge+number+delta&quot;,     title = {'text': &quot;Success Metric&quot;},     delta = {'reference': 3.9},     gauge = {'bar': {'color': &quot;lightgreen&quot;},         'axis': {'range': [None, 5]},              'steps' : [                  {'range': [0, 2.5], 'color': &quot;lightgray&quot;},                  {'range': [2.5, 4], 'color': &quot;gray&quot;}],           })) fig.show()<\/code><\/pre>\n<pre><code class=\"python\">import plotly.graph_objects as go fig = go.Figure(go.Indicator(     title = {'text': &quot;Success Metric&quot;},      mode = &quot;number+delta&quot;,     value = 300,     delta = {'reference': 160})) fig.show()   fig = go.Figure(go.Indicator(      title = {'text': &quot;Success Metric&quot;},     mode = &quot;delta&quot;,     value = 40,  delta = {'reference': 160})) fig.show() <\/code><\/pre>\n<h3>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0435!<\/h3>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u044b \u043d\u0430\u0448\u043b\u0438 \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435. \u041e\u0441\u0442\u0430\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u0434\u043e\u043c\u0430, \u0431\u0443\u0434\u044c\u0442\u0435 \u0432 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u0440\u0430\u0431\u043e\u0442\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e.<\/p>\n<hr>\n<p>  <a href=\"https:\/\/otus.pw\/mb8CI\/\">\u0423\u0437\u043d\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043a\u0443\u0440\u0441\u0435.<br \/>  <\/a>  <\/p>\n<hr>\n<\/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\/company\/otus\/blog\/502568\/\"> https:\/\/habr.com\/ru\/company\/otus\/blog\/502568\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/502568\/\"><i><b>\u0421\u0442\u0430\u0442\u044c\u044f \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u0430 \u0432 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u0443\u0440\u0441\u0430 <a href=\"https:\/\/otus.pw\/mb8CI\/\">\u00ab\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a Python\u00bb<\/a>.<\/b><\/i><\/p>\n<hr>\n<p>  \u0421\u0442\u043e\u0440\u0438\u0442\u0435\u043b\u043b\u0438\u043d\u0433 \u2013 \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0445 \u043d\u0430\u0432\u044b\u043a\u043e\u0432 \u0434\u043b\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0442\u043e\u0431\u044b \u0434\u043e\u043d\u043e\u0441\u0438\u0442\u044c \u0438\u0434\u0435\u0438 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0443\u044e \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u044e. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 5 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0445\u043e\u0434\u044f\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u0438 \u043c\u043e\u0433\u0443\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0430\u0448\u0443 Data Story \u0431\u043e\u043b\u0435\u0435 \u044d\u0441\u0442\u0435\u0442\u0438\u0447\u043d\u043e\u0439 \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0439. \u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <a href=\"https:\/\/plotly.com\/python\/\">Plotly<\/a> \u043d\u0430 Python (\u043e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043d\u0430 R), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0443\u0441\u0438\u043b\u0438\u044f\u043c\u0438.<\/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-303787","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303787","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=303787"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303787\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=303787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=303787"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=303787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}