{"id":309931,"date":"2020-09-15T09:00:18","date_gmt":"2020-09-15T09:00:18","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=309931"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=309931","title":{"rendered":"Pikabu-dataset"},"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\/post\/519054\/\">\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 dataset \u043f\u043e\u0441\u0442\u043e\u0432 \u0441 pikabu.ru c \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0434\u0430\u0442\u0430\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438. \u0421\u0430\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 450\u043a \u0448\u0442\u0443\u043a \u0441\u043e\u0431\u0440\u0430\u043d \u043b\u0443\u0447\u0448\u0438\u043c\u0438 \u043a\u0440\u0443\u0433\u043b\u043e\u0441\u0443\u0442\u043e\u0447\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0441\u0435\u0440\u0430\u043c\u0438, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d \u043e\u0442\u0434\u0443\u0448\u043a\u0430\u043c\u0438, \u0443\u0431\u0438\u0440\u0430\u044e\u0449\u0438\u043c\u0438 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b \u0441\u0442\u0430\u0442\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0448\u043f\u0438\u0433\u043e\u0432\u0430\u043d \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c\u0438, \u0441\u043c\u044b\u0441\u043b \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u044b\u043c. \u0417\u0434\u0435\u0441\u044c \u043d\u0435 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u0441\u0430\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0430\u0439\u0442\u043e\u0432. \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u043e\u0441\u0442\u0430\u0445 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 ma\u0441hine learning \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430. <br \/>   <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ol\/1k\/it\/ol1kitcxgtzee5zcv8gimiib8ci.jpeg\"><br \/>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0443 \u0441 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u0435\u0441\u0442\u0438 \u043a\u0430\u043a \u0432 \u043e\u0431\u044b\u043a\u043d\u043e\u0432\u0435\u043d\u043d\u043e\u043c excel, \u0442\u0430\u043a \u0438 jupyter notebook, \u043f\u043e\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u0442\u0430\u0431\u0443\u043b\u044f\u0446\u0438\u0435\u0439. \u041c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435, \u0438 \u0432\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0432 jupyter notebook.<\/p>\n<p>  \u0411\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 windows. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u0439\u0434\u0435\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f cmd \u0432 \u043f\u0430\u043f\u043a\u0443 \u0441\u043e \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u044b\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u043e\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c <b>jupyter notebook<\/b> \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439. <br \/>  \u0414\u0430\u043b\u0435\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u0438.  <\/p>\n<pre><code class=\"python\">import pandas as pd import numpy as np <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u0442\u0430\u0441\u0435\u0442 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u0438\u0445 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430:  <\/p>\n<pre><code class=\"python\">headers=['story_title','link','story_id','data_rating','data_timestamp','story_comments','data_author_id','data_meta_rating','user_name','user_link','story__community_link'] <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e: \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043d\u0435\u0435, id \u0441\u0442\u0430\u0442\u044c\u0438, \u0440\u0435\u0439\u0442\u0438\u043d\u0433 (\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043b\u044e\u0441\u043e\u0432), \u0434\u0430\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432, id \u0430\u0432\u0442\u043e\u0440\u0430, \u043c\u0435\u0442\u0430 \u0440\u0435\u0439\u0442\u0438\u043d\u0433 \u0441\u0442\u0430\u0442\u044c\u0438, \u0438\u043c\u044f \u0430\u0432\u0442\u043e\u0440\u0430, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0430\u0432\u0442\u043e\u0440\u0430, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043a\u043e\u043c\u044c\u044e\u043d\u0438\u0442\u0438.<\/p>\n<p>  \u0421\u0447\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442.  <\/p>\n<pre><code class=\"python\">df = pd.read_csv('400k-pikabu.csv',parse_dates=['data_timestamp'],                    warn_bad_lines=True,                    index_col = False,                                       dtype ={'story_title':'object','link':'object','story_id':'float32','data_rating':'float32',                    'story_comments':'float32','data_author_id':'float32'},                    delimiter='\\t',names=headers) <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0431\u044b\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043a\u0430\u043a \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0434\u0430\u0442\u0430\u0441\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 468595 \u0441\u0442\u0440\u043e\u043a,11 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432.  <\/p>\n<pre><code class=\"python\">print(df.shape)#468595 \u0441\u0442\u0440\u043e\u043a,11 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0435 5 \u0437\u0430\u043f\u0438\u0441\u0435\u0439  <\/p>\n<pre><code class=\"python\">df.head(5) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/lr\/i9\/s4\/lri9s42nzthmu1njf8myw7q6il4.jpeg\"><\/p>\n<p>  \u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435:  <\/p>\n<pre><code class=\"python\">df.describe()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/lo\/rh\/sb\/lorhsb_bqfby1zpsodgsihfkn9c.jpeg\"><\/p>\n<p>  <b>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435<\/b><\/p>\n<p>  \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u0430\u0440\u0441\u0435\u0440\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u043d\u0435 \u043f\u043e\u043a\u043b\u0430\u0434\u0430\u044f \u0440\u0443\u043a, \u0432 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0434\u044b\u0440\u044b, \u0438\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0442\u0432\u0435\u0440\u0441\u0442\u0438\u044f, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u043c\u0438. \u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0438 \u0432 pandas \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c NaN. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u043f\u0443\u0441\u0442\u043e\u0442\u0430\u043c\u0438:  <\/p>\n<pre><code class=\"python\">len(df.loc[pd.isnull( df['story_title'])]) <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435:  <\/p>\n<pre><code class=\"python\">df.loc[pd.isnull( df['story_title'])] <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dm\/uh\/ad\/dmuhadi_mt1k9_flzrcbk2ximwu.jpeg\"><\/p>\n<p>  1444 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u043c\u0438 \u043e\u0431\u0449\u0435\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u044b \u043d\u0435 \u043f\u043e\u0440\u0442\u044f\u0442, \u043d\u043e, \u0432\u0441\u0435 \u0442\u0430\u043a\u0438, \u0438\u0437\u0431\u0430\u0432\u0438\u043c\u0441\u044f \u043e\u0442 \u043d\u0438\u0445:  <\/p>\n<pre><code class=\"python\">data1=df.dropna(axis=0, thresh=5) <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e:  <\/p>\n<pre><code class=\"python\">len(data1.loc[pd.isnull(data1['story_id'])])  <\/code><\/pre>\n<p>  <b>\u041f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u043e\u043c.<\/b><br \/>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043b\u043e\u043d\u043e\u043a  <\/p>\n<pre><code class=\"python\">df.columns<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/y5\/_-\/oo\/y5_-oo5icd9bw8c0sdpv6ltnimk.jpeg\"><\/p>\n<p>  \u0412\u044b\u0431\u0435\u0440\u0435\u043c \u043f\u0435\u0440\u0432\u0443\u044e \u043a\u043e\u043b\u043e\u043d\u043a\u0443  <\/p>\n<pre><code class=\"python\">col = df['story_title'] col<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/a2\/tw\/ay\/a2twayty9rvuoogdb6wtdou78ym.jpeg\"><\/p>\n<p>  \u0412\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0432 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435  <\/p>\n<pre><code class=\"python\">data1.min()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gt\/gh\/3x\/gtgh3xq5skcz07fkuqt3jnwclua.jpeg\"><\/p>\n<p>  \u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c  <\/p>\n<pre><code class=\"python\">data1.max()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ix\/nq\/4e\/ixnq4evm6jcjwqjxpy32tunlum0.jpeg\"><\/p>\n<p>  \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e:  <\/p>\n<pre><code class=\"python\">data1.loc[:,['user_name', 'data_rating', 'story_comments']].min()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/w1\/1b\/-p\/w11b-pu_sgyrefi8yde3e593o7e.jpeg\"><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432:  <\/p>\n<pre><code class=\"python\">arr = data1[['story_id', 'data_rating', 'data_timestamp','user_name']].values<\/code><\/pre>\n<p>  \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430:  <\/p>\n<pre><code class=\"python\">arr[:, 1] #\u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0440\u0435\u0439\u0442\u0438\u043d\u0433 <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tq\/xr\/o3\/tqxro3ltodi92bq5clkz-pefu2i.jpeg\"><\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u0441 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u043e\u043c \u0431\u043e\u043b\u0435\u0435 10000:  <\/p>\n<pre><code class=\"python\">print((arr[:, 1] &gt; 10000.0).sum())<\/code><\/pre>\n<p>  \u0422\u043e\u043b\u044c\u043a\u043e 2672 \u0441\u0442\u0430\u0442\u0435\u0439 \u0438\u043c\u0435\u044e\u0442 \u0441\u0432\u0435\u0440\u0445\u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0440\u0435\u0439\u0442\u0438\u043d\u0433 \u0438\u0437 450\u043a<\/p>\n<p>  <b>\u041f\u043e\u0440\u0438\u0441\u0443\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u043a\u0438<\/b><br \/>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c:  <\/p>\n<pre><code class=\"python\">import matplotlib.pyplot as plt<\/code><\/pre>\n<p>  \u0412\u044b\u044f\u0441\u043d\u0438\u043c \u0435\u0441\u043b\u0438 \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 id \u0430\u0432\u0442\u043e\u0440\u0430 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u043e\u043c \u0441\u0442\u0430\u0442\u044c\u0438?  <\/p>\n<pre><code class=\"python\">plt.scatter(data1['data_author_id'], data1['data_rating']) plt.xlabel('data_author_id')  plt.ylabel('data_rating')<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ny\/8d\/9y\/ny8d9yetxdtccqfqtinmntnlp6c.jpeg\"><br \/>  \u0418\u0437-\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u043e \u0443\u043b\u043e\u0432\u0438\u0442\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u044c \u0438, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043e\u043d\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 id \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u043e\u043c \u0441\u0442\u0430\u0442\u044c\u0438?  <\/p>\n<pre><code class=\"python\">plt.scatter(data1['story_id'], data1['data_rating']) plt.xlabel('story_id')  plt.ylabel('data_rating')<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ll\/wp\/pi\/llwppiyy412pdepa623eh5bzpv8.jpeg\"><br \/>  \u0417\u0434\u0435\u0441\u044c \u0437\u0430\u043c\u0435\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u043e\u0441\u0442\u044b \u0441 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u0438\u043c \u043d\u043e\u043c\u0435\u0440\u043e\u043c (\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0437\u0434\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u044b) \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u0440\u0435\u0439\u0442\u0438\u043d\u0433, \u0437\u0430 \u043d\u0438\u0445 \u0447\u0430\u0449\u0435 \u043e\u0442\u0434\u0430\u044e\u0442 \u0433\u043e\u043b\u043e\u0441\u0430. \u0420\u0430\u0441\u0442\u0435\u0442 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u0430?<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u0434\u0430\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u043e\u043c?  <\/p>\n<pre><code class=\"python\">plt.scatter(data1['data_timestamp'], data1['data_rating']) plt.xlabel('data_timestamp')  plt.ylabel('data_rating')<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gi\/zc\/c7\/gizcc7gsc4orov_jfegrep8fryc.jpeg\"><br \/>  \u0422\u0430\u043a\u0436\u0435 \u0432\u0438\u0434\u043d\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0437\u0434\u043d\u0438\u043c\u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f\u043c\u0438 \u0438 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u043e\u043c \u043f\u043e\u0441\u0442\u043e\u0432. \u0411\u043e\u043b\u0435\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0438\u043b\u0438 \u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u043e\u0441\u0442 \u043f\u043e\u0441\u0435\u0449\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430? <\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u043e\u043c \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u043e\u0432 \u043a \u043d\u0435\u0439?  <\/p>\n<pre><code class=\"python\">plt.scatter(data1['story_comments'], data1['data_rating']) plt.xlabel('story_comments')  plt.ylabel('data_rating')<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/7_\/o2\/tu\/7_o2tuxqrf0r_gdmuc-ejwpbz4w.jpeg\"><br \/>  \u0417\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c, \u0445\u043e\u0442\u044f \u043e\u043d\u0430 \u0441\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u044b\u043b\u0435\u043d\u0430. \u041b\u043e\u0433\u0438\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u0435\u0441\u0442\u044c, \u0447\u0435\u043c \u0432\u044b\u0448\u0435 \u0440\u0435\u0439\u0442\u0438\u043d\u0433 \u043f\u043e\u0441\u0442\u0430, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0442\u043e\u043f \u0430\u0432\u0442\u043e\u0440\u043e\u0432 (\u0430\u0432\u0442\u043e\u0440\u043e\u0432, \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u044b\u0439 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u043e\u0432 \u043f\u043e\u0441\u0442\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u0435\u043d):  <\/p>\n<pre><code class=\"python\">top_users_df = data1.groupby('user_name')[['data_rating']].sum().sort_values('data_rating', ascending=False).head(10)    top_users_df <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/8m\/hh\/ed\/8mhhedbdp4p1aksgxehgguxge0q.jpeg\"><br \/>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438:  <\/p>\n<pre><code class=\"python\">top_users_df.style.bar()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ne\/hy\/yh\/nehyyhpf5buazw3otl5i60iq4ww.jpeg\"><\/p>\n<p>  <b>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, seaborn.<\/b>  <\/p>\n<pre><code class=\"python\"># \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a  ! pip3 install seaborn from __future__ import (absolute_import, division,                         print_function, unicode_literals) # \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f import warnings warnings.simplefilter('ignore')  # \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043f\u0440\u044f\u043c\u043e \u0432 jupyter'e %pylab inline #\u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0432 svg \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u0442\u043a\u0438\u043c\u0438 %config InlineBackend.figure_format = 'svg'   #\u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 from pylab import rcParams rcParams['figure.figsize'] = 6,3 import seaborn as sns<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0441 id \u043f\u043e\u0441\u0442\u043e\u0432, \u0438\u0445 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u043e\u043c \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 .png:  <\/p>\n<pre><code class=\"python\">%config InlineBackend.figure_format = 'png'  sns_plot = sns.pairplot(data1[['story_id', 'data_rating', 'story_comments']]); sns_plot.savefig('pairplot.png') <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jm\/sv\/-g\/jmsv-gestuwn-hmtmwgjrpnrqxc.jpeg\"><\/p>\n<p>  <b>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Plotly.<\/b>  <\/p>\n<pre><code class=\"python\">from plotly.offline import init_notebook_mode, iplot import plotly import plotly.graph_objs as go init_notebook_mode(connected=True) <\/code><\/pre>\n<p>  \u0421\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0434\u0430\u0442\u0435 \u0438 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u043c\u0443 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0443 \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u044d\u0442\u0443 \u0434\u0430\u0442\u0443:  <\/p>\n<pre><code class=\"python\">df2 = data1.groupby('data_timestamp')[['data_rating']].sum() df2.head()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zd\/qt\/jp\/zdqtjpvpqqhdnihujtsos39ozzg.jpeg\"><\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u0432\u0441\u0435\u0433\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u043b\u043e \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0434\u0430\u0442\u0443 (\u043c\u0435\u0441\u044f\u0446):  <\/p>\n<pre><code class=\"python\">released_stories = data1.groupby('data_timestamp')[['story_id']].count() released_stories.head()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/up\/2p\/an\/up2panfnyhytby7hxn0azgx6vx4.jpeg\"><br \/>  \u0421\u043a\u043b\u0435\u0438\u043c \u0434\u0432\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b:  <\/p>\n<pre><code class=\"python\">years_df = df2.join(released_stories) years_df.head()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/np\/x7\/dw\/npx7dwalpajtqgxmrah_cwvki40.jpeg\"><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f plotly:  <\/p>\n<pre><code class=\"python\">trace0 = go.Scatter(     x=years_df.index,     y=years_df.data_rating,     name='data_rating' ) trace1 = go.Scatter(     x=years_df.index,     y=years_df.story_id,     name='story_id' ) data = [trace0, trace1] layout = {'title': 'Statistics'} fig = go.Figure(data=data, layout=layout) iplot(fig, show_link=False) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/st\/f_\/0i\/stf_0iwmyyciiiqvil3xevyjbwq.jpeg\"><br \/>  \u041f\u0440\u0435\u043b\u0435\u0441\u0442\u044c plotly \u0432 \u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u043f\u0440\u0438 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0432\u0438\u0434\u0435\u043d \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u044b\u0439 \u0440\u0435\u0439\u0442\u0438\u043d\u0433 \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0434\u0430\u0442\u0443(\u043c\u0435\u0441\u044f\u0446). \u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0440\u0435\u0439\u0442\u0438\u043d\u0433 \u043f\u0440\u043e\u0441\u0435\u043b \u0432 2020. \u041d\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u0442\u0435\u043c, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u0438\u0437 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043e \u043f\u0430\u0440\u0441\u0435\u0440\u0430\u043c\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u0441\u0442\u044b \u043f\u043e\u043a\u0430 \u043d\u0435 \u043e\u0431\u0440\u043e\u0441\u043b\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u043b\u044e\u0441\u043e\u0432.<br \/>  \u0412\u043d\u0438\u0437\u0443 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u043a\u0440\u0430\u0441\u043d\u043e\u0439 \u043b\u0438\u043d\u0438\u0435\u0439 \u0442\u0430\u043a \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0434\u0430\u0442\u0443.<br \/>  \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0433\u0440\u0430\u0444\u0438\u043a \u0432 \u0432\u0438\u0434\u0435 html-\u0444\u0430\u0439\u043b\u0430.  <\/p>\n<pre><code class=\"python\">plotly.offline.plot(fig, filename='stats_pikabu.html', show_link=False);<\/code><\/pre>\n<p>  <b>\u0413\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/b><br \/>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0432\u0442\u043e\u0440\u043e\u0432 \u0432 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435:  <\/p>\n<pre><code class=\"python\">data1.groupby('user_name').size()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/o9\/wc\/7k\/o9wc7km2rqlnusta40bo1duzhwm.jpeg\"><\/p>\n<p>  \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0441\u0435\u0433\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u0430\u0432\u0442\u043e\u0440\u0430:  <\/p>\n<pre><code class=\"python\">data1['user_name'].value_counts()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5d\/bu\/f3\/5dbuf3ebllsyurp0dsa7lz4cdhk.jpeg\"><\/p>\n<p>  \u041a\u0442\u043e \u043f\u0438\u0448\u0435\u0442 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e (\u0431\u043e\u043b\u0435\u0435 500 \u0441\u0442\u0430\u0442\u0435\u0439):  <\/p>\n<pre><code class=\"python\">for i in data1.groupby('user_name').size():     if i&gt;500:                 print (data1.iloc[i,8],i) #8-\u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0441 user_name<\/code><\/pre>\n<p>  \u0422\u0430\u043a \u0432\u043e\u0442 \u043a\u0442\u043e \u00ab\u0437\u0430\u0441\u043e\u0440\u044f\u0435\u0442\u00bb \u0440\u0435\u0441\u0443\u0440\u0441 ). \u0418\u0445 \u043d\u0435 \u0442\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u043e:  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0430\u0432\u0442\u043e\u0440\u044b<\/b>                         <\/p>\n<div class=\"spoiler_text\">crackcraft 531<br \/>  mpazzz 568<br \/>  kastamurzik 589<br \/>  pbdsu 773<br \/>  RedCatBlackFox 4882<br \/>  Wishhnya 1412<br \/>  haalward 1190<br \/>  iProcione 690<br \/>  tooNormal 651<br \/>  Drugayakuhnya 566<br \/>  Ozzyab 1088<br \/>  kalinkaElena9 711<br \/>  Freshik04 665<br \/>  100pudofff 905<br \/>  100pudofff 1251<br \/>  Elvina.Brestel 1533<br \/>  1570525 543<br \/>  Samorodok 597<br \/>  Mr.Kolyma 592<br \/>  kka2012 505<br \/>  DENTAARIUM 963<br \/>  4nat1k 600<br \/>  chaserLI 650<br \/>  kostas26 1192<br \/>  portal13 895<br \/>  exJustice 1477<br \/>  alc19 525<br \/>  kuchka70 572<br \/>  SovietPosters 781<br \/>  Grand.Bro 1051<br \/>  Rogo3in 1068<br \/>  fylhtq2222 774<br \/>  deystvitelno 539<br \/>  lilo26 802<br \/>  al56.81 2498<br \/>  Hebrew01 596<br \/>  TheRovsh 803<br \/>  ToBapuLLI 1143<br \/>  ragnarok777 893<br \/>  Ichizon 890<br \/>  hoks1 610<br \/>  arthik 700  <\/div>\n<\/p><\/div>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043c\u044c\u044e\u043d\u0438\u0442\u0438 \u043d\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u0435 \u0432\u0441\u0435\u0433\u043e:  <\/p>\n<pre><code class=\"python\">data1.groupby('story__community_link').size() <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bm\/xk\/bz\/bmxkbzebchid3lzcindztjqgmri.jpeg\"><br \/>  \u0418 \u043a\u0430\u043a\u043e\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0441\u0430\u043c\u043e\u0435 \u043f\u043b\u043e\u0434\u043e\u0432\u0438\u0442\u043e\u0435:  <\/p>\n<pre><code class=\"python\">data1['story__community_link'].value_counts()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/6i\/kh\/u1\/6ikhu10yskxlgmucctj6m4wkmus.jpeg\"><br \/>  *\u0414\u0430\u043d\u043d\u044b\u0435 \u043e \u043a\u043e\u043c\u044c\u044e\u043d\u0438\u0442\u0438 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0432\u043e\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c\u043e\u0435 \u043a\u043e\u043c\u044c\u044e\u043d\u0438\u0442\u0438, \u0430 \u0430\u0432\u0442\u043e\u0440\u044b \u0447\u0430\u0441\u0442\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0442\u0443\u043a.<\/p>\n<p>  \u041d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c <b>\u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u0438\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446<\/b>.<br \/>  \u042d\u0442\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430.<br \/>  \u041f\u0440\u043e\u0441\u0442\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0442\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0430 \u0441\u0442\u0430\u0442\u044c\u0438 \u043a \u0433\u0440\u0443\u043f\u043f\u0435.<br \/>  \u0415\u0441\u043b\u0438 \u0440\u0435\u0439\u0442\u0438\u043d\u0433 \u0431\u043e\u043b\u044c\u0448\u0435 &lt; 5000 \u2014 bad, &gt; 5000 \u2014 good.  <\/p>\n<pre><code class=\"python\">def ratingGroup( row ):     # \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0430 \u043d\u0435 \u0440\u0430\u0432\u043d\u043e NaN     if not pd.isnull( row['data_rating'] ):         if row['data_rating'] &lt;= 5000:             return 'bad'         if row['data_rating'] &gt;= 20000:             return 'good'                  # \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430 NaN, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c Undef     return 'Undef'<\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e ratingGroup \u043a DataFrame \u0438 \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 -ratingGroup  <\/p>\n<pre><code class=\"python\">data1['ratingGroup'] = data1.apply( ratingGroup, axis = 1 ) data1.head(10)<\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/x2\/qi\/cr\/x2qicrzmhc-p88gv6fgv0ue6rjc.jpeg\"><\/p>\n<p>  \u0421\u043a\u0430\u0447\u0430\u0442\u044c \u2014 <a href=\"https:\/\/yadi.sk\/d\/dNYj_cGesN5o1Q\" rel=\"nofollow\">\u0434\u0430\u0442\u0430\u0441\u0435\u0442<\/a>.<br \/>  \u0421\u043a\u0430\u0447\u0430\u0442\u044c \u043d\u0435\u043e\u0447\u0438\u0449\u0435\u043d\u043d\u044b\u0439 \u0434\u0430\u0442\u0430\u0441\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u0441\u0430\u043c\u043e\u043c\u0443 \u043f\u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u043e\u0442 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u2014 <a href=\"https:\/\/yadi.sk\/d\/3pDs0NOOx_QNJw\" rel=\"nofollow\">\u0434\u0430\u0442\u0430\u0441\u0435\u0442<\/a>.<br \/>  *python \u0447\u0438\u0441\u0442\u0438\u0442 (\u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b \u0441\u0442\u0440\u043e\u043a \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 id \u0441\u0442\u0430\u0442\u044c\u0438) \u043f\u043e\u0447\u0442\u0438 \u0447\u0430\u0441! \u0415\u0441\u043b\u0438 \u043a\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u0442 \u043a\u043e\u0434 \u043d\u0430 \u0441++ \u0431\u0443\u0434\u0443 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d!:  <\/p>\n<pre><code class=\"python\">with open('f-final-clean-.txt','a',encoding='utf8',newline='') as f:     for line in my_lines:         try:             b=line.split(&quot;\\t&quot;)[2]             if b in a:                         pass             else:                 a.append(b)                             f.write(line)                     except:             print(line) <\/code><\/pre>\n<p>  Jupyter notebook \u2014 <a href=\"https:\/\/yadi.sk\/d\/-1xSVrbY-yA25A\" rel=\"nofollow\">\u0441\u043a\u0430\u0447\u0430\u0442\u044c<\/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\/519054\/\"> https:\/\/habr.com\/ru\/post\/519054\/<\/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\/post\/519054\/\">\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 dataset \u043f\u043e\u0441\u0442\u043e\u0432 \u0441 pikabu.ru c \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0434\u0430\u0442\u0430\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438. \u0421\u0430\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 450\u043a \u0448\u0442\u0443\u043a \u0441\u043e\u0431\u0440\u0430\u043d \u043b\u0443\u0447\u0448\u0438\u043c\u0438 \u043a\u0440\u0443\u0433\u043b\u043e\u0441\u0443\u0442\u043e\u0447\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0441\u0435\u0440\u0430\u043c\u0438, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d \u043e\u0442\u0434\u0443\u0448\u043a\u0430\u043c\u0438, \u0443\u0431\u0438\u0440\u0430\u044e\u0449\u0438\u043c\u0438 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b \u0441\u0442\u0430\u0442\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0448\u043f\u0438\u0433\u043e\u0432\u0430\u043d \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c\u0438, \u0441\u043c\u044b\u0441\u043b \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u044b\u043c. \u0417\u0434\u0435\u0441\u044c \u043d\u0435 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u0441\u0430\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0430\u0439\u0442\u043e\u0432. \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u043e\u0441\u0442\u0430\u0445 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 ma\u0441hine learning \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430. <br \/>   <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ol\/1k\/it\/ol1kitcxgtzee5zcv8gimiib8ci.jpeg\">  <\/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-309931","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/309931","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=309931"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/309931\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=309931"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=309931"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=309931"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}