{"id":343509,"date":"2023-01-04T15:02:20","date_gmt":"2023-01-04T15:02:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=343509"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=343509","title":{"rendered":"<span>Heatmap \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e folium<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/2a\/0g\/yf\/2a0gyf2wozqpoweu2aiva6h8tpu.png\" data-src=\"https:\/\/habrastorage.org\/webt\/2a\/0g\/yf\/2a0gyf2wozqpoweu2aiva6h8tpu.png\"\/><br \/>  \u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439 \u0432 \u0441\u0444\u0435\u0440\u0435 Data Science \u0441 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0435\u0439 \u043f\u043e \u0433\u043e\u0440\u043e\u0434\u0430\u043c.<\/p>\n<p>  <\/p>\n<p>\u0414\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0432 3 \u044d\u0442\u0430\u043f\u0430:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439 \u0441 hh API<\/li>\n<li>\u0410\u043a\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0439 \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0438 \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430<\/li>\n<li>\u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 heatmap \u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439 \u0438 \u043f\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0439 \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e folium<a name=\"habracut\"><\/a><\/li>\n<\/ol>\n<p>  <\/p>\n<h2 id=\"1-parsing-vakansiy-s-hh-api\">1. \u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439 \u0441 hh API<\/h2>\n<p>  <\/p>\n<p>\u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c API hh.ru (<a href=\"https:\/\/github.com\/hhru\/api\/blob\/master\/docs\/general.md\" rel=\"nofollow noopener noreferrer\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>).<\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 API:<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440<\/th>\n<th>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>&#8216;text&#8217;<\/td>\n<td>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439<\/td>\n<\/tr>\n<tr>\n<td>&#8216;page&#8217;<\/td>\n<td>\u041d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439<\/td>\n<\/tr>\n<tr>\n<td>&#8216;per_page&#8217;<\/td>\n<td>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 (\u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c 100)<\/td>\n<\/tr>\n<tr>\n<td>&#8216;only_with_salary&#8217;<\/td>\n<td>\u0422\u043e\u043b\u044c\u043a\u043e \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u044b (\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u043f\u0440\u043e\u0441\u0430\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0438 \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u044b)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<pre><code class=\"python\">def get_vacancies(skills, filename, pages=10):     res = []     for indx, skill in enumerate(skills):         print(f'\\ncollecting &lt;{skill}> ({indx+1} of {len(skills)})')         for page in range(pages):             params = {                 'text': f'{skill}',                 'page': page,                 'per_page': 100,                 'only_with_salary': 'true',             }             req = requests.get('https:\/\/api.hh.ru\/vacancies', params).json()             if 'items' in req.keys():                 res.extend(req['items'])             print('|', end='')  df = pd.DataFrame(res) df.to_csv(filename, index=False)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0434\u0435\u0440\u0438\u043a\u0442\u043e\u0440\u0438\u0438 \u0444\u0430\u0439\u043b \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c.<br \/>  \u041f\u043e\u043b\u043d\u044b\u0439 \u043b\u0438\u0441\u0442\u0438\u043d\u0433 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0441 \u043e\u0447\u0438\u0441\u0442\u043a\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 <a href=\"https:\/\/github.com\/rufous86\/hh_parcing\/blob\/main\/parcing.py\" rel=\"nofollow noopener noreferrer\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430, \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0435 \u0434\u043b\u044f \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0444\u0435\u0440\u044b. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0432 \u0444\u0430\u0439\u043b &#8216;data.csv&#8217;.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">skill_list = ['machine AND learning', 'data AND science', 'NLP',               'spark', 'hadoop', 'pandas', 'dask', 'deep AND learning', 'pytorch',               'tensorflow', 'keras', 'ai AND developer', 'computer AND vision',               '\u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 AND \u0441\u0435\u0442\u0438', 'big AND data']  get_vacancies(skill_list, 'data.csv')<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ro\/fl\/fv\/roflfvhsmbeb-rtg207ncjzi6rs.png\" alt=\"df_head1.png\" data-src=\"https:\/\/habrastorage.org\/webt\/ro\/fl\/fv\/roflfvhsmbeb-rtg207ncjzi6rs.png\"\/><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/54\/u2\/pw\/54u2pwc1a4gclzu4jg9ckt_qxsi.png\" alt=\"df_info.png\" data-src=\"https:\/\/habrastorage.org\/webt\/54\/u2\/pw\/54u2pwc1a4gclzu4jg9ckt_qxsi.png\"\/><\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0438 &#8216;city&#8217; \u0438 &#8216;salary_mean&#8217;.<\/p>\n<p>  <\/p>\n<h2 id=\"2-aktualizaciya-geolokaciy-kazhdoy-vakansii-s-tochnostyu-do-naselennogo-punkta\">2. \u0410\u043a\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0439 \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0438 \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430<\/h2>\n<p>  <\/p>\n<p>\u0425\u043e\u0442\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0438 \u043d\u0430 hh.ru \u0441\u043d\u0430\u0431\u0436\u0435\u043d\u044b \u0433\u0435\u043e\u043c\u0435\u0442\u043a\u0430\u043c\u0438, \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u0445 \u0441\u043e\u043c\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430 (\u043d\u0430 \u043f\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0433\u043e\u0440\u043e\u0434\u0430 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0432 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u043c \u0438\u043c \u043c\u0435\u0441\u0442\u0435, \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u0436\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043f\u043e\u0441\u0440\u0435\u0434\u0438 \u0427\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0440\u044f).<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0430\u043a\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u044f\u0445, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 geopy (<a href=\"https:\/\/geopy.readthedocs.io\/en\/stable\/\" rel=\"nofollow noopener noreferrer\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>).<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from geopy.geocoders import Nominatim geolocator = Nominatim(user_agent=\"geo\")  def get_coords(city):     geo = geolocator.geocode(city)     if geo:         return geo.longitude, geo.latitude     else:         return np.nan, np.nan  coords = pd.DataFrame(data=df['city'].unique(), columns=['city']) coords['coords'] = (coords['city']                         .apply(lambda x: get_coords(x)))  df = df.merge(coords, on='city')  df.head()<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/cp\/n5\/jj\/cpn5jj6dbylhsu6vrdo0qewyxhw.png\" alt=\"df_head2.png\" data-src=\"https:\/\/habrastorage.org\/webt\/cp\/n5\/jj\/cpn5jj6dbylhsu6vrdo0qewyxhw.png\"\/><\/p>\n<p>  <\/p>\n<h2 id=\"3-postroenie-heatmap-po-kolichestvu-vakansiy-i-po-sredney-predlagaemoy-zarplate-s-pomoschyu-folium\">3. \u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 heatmap \u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439 \u0438 \u043f\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0439 \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e folium<\/h2>\n<p>  <\/p>\n<p><a href=\"https:\/\/python-visualization.github.io\/folium\/\" rel=\"nofollow noopener noreferrer\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043d\u0430 folium<\/a><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import folium from folium import plugins, branca<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 Map \u0434\u043b\u044f \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u0440\u0442\u044b. \u0412 \u043d\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043a\u0430\u0440\u0442\u044b.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">mapObj = folium.Map(location=[57.23337810789467, 48.05744173358704], zoom_start=5)<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p><u>\u041b\u0430\u0439\u0444\u0445\u0430\u043a<\/u>. \u0414\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0438 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 Map \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 html.  <\/p>\n<pre><code class=\"python\">mapObj = folium.Map() mapObj.save('output.html')<\/code><\/pre>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b &#8216;output.html&#8217;. \u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c\u0441\u044f \u0432 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0435\u0435 \u043c\u0435\u0441\u0442\u043e \u043d\u0430 \u043a\u0430\u0440\u0442\u0435. \u041f\u0440\u0430\u0432\u0430\u044f \u043a\u043d\u043e\u043f\u043a\u0430 -> inspect -> Console. \u0412\u0432\u043e\u0434\u0438\u043c:<\/p>\n<p>  map_&lt;\u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0431\u0443\u043a\u0432\u044b, \u0446\u0438\u0444\u0440\u044b>.getCenter() \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0446\u0435\u043d\u0442\u0440\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430.<\/p>\n<p>  map_&lt;\u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0431\u0443\u043a\u0432\u044b, \u0446\u0438\u0444\u0440\u044b>.getZoom() \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c zoom \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430.<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/92\/d0\/ln\/92d0ln2iffjygawfr7c-lqtjoom.png\" alt=\"map_get.png\" data-src=\"https:\/\/habrastorage.org\/webt\/92\/d0\/ln\/92d0ln2iffjygawfr7c-lqtjoom.png\"\/><\/p>\n<p>  <\/p>\n<p>\u041c\u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0447\u0435\u0440\u0442\u0438\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0440\u0435\u0433\u0438\u043e\u043d\u043e\u0432 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0430\u0448\u0443 \u043a\u0430\u0440\u0442\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438\u0437 <a href=\"https:\/\/github.com\/rufous86\/hh_parcing\/blob\/main\/russia.geojson\" rel=\"nofollow noopener noreferrer\">\u0444\u0430\u0439\u043b\u0430<\/a> \u0444\u043e\u0440\u043c\u0430\u0442\u0430 geojson. \u0412 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 &#8216;style_function&#8217; \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u043c\u0438 \u0441\u0442\u0438\u043b\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u0448\u0435\u0433\u043e geojson (\u0446\u0432\u0435\u0442 \u043b\u0438\u043d\u0438\u0439, \u0438\u0445 \u0442\u043e\u043b\u0449\u0438\u043d\u0430, \u0446\u0432\u0435\u0442 \u0437\u0430\u043b\u0438\u0432\u043a\u0438, \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c).<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">bordersStyle = {     'color': 'red',     'weight': 0.2,     'fillColor': 'grey',     'fillOpacity': 0.3 }  folium.GeoJson('russia.geojson',                name='Russia',               style_function=lambda x: bordersStyle).add_to(mapObj)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0435\u0433\u043e \u0432 \u043a\u043b\u0430\u0441\u0441 HeatMap. \u0414\u0430\u0431\u0430\u0432\u043b\u044f\u0435\u043c HeatMap \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u043a\u0430\u0440\u0442\u044b.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">heat_data = [[lat, lon] for lon, lat in df['coords']] plugins.HeatMap(heat_data, radius=18, gradient={0.4: 'blue', 0.65: 'lime', 1: 'red'}).add_to(mapObj)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041b\u0435\u0433\u0435\u043d\u0434\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0441\u0441\u0430 LinearColormap:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">colormap = branca.colormap.LinearColormap(['blue', 'lime', 'red'],                                            vmin=1,                                            vmax=df['city'].value_counts()[0],                                            caption='\u041d\u0430\u0441\u044b\u0449\u0435\u043d\u0438\u0435 \u0440\u044b\u043d\u043a\u0430 \u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439') colormap.add_to(mapObj)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u0430\u0440\u0442\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 &#8216;html&#8217;.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">mapObj.save('output1.html')<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/4y\/st\/uy\/4ystuyoddryttytkenasugcbonk.png\" alt=\"map_count.png\" data-src=\"https:\/\/habrastorage.org\/webt\/4y\/st\/uy\/4ystuyoddryttytkenasugcbonk.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0422\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0435\u043c \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u0435. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u2014 \u0432 \u0441\u043f\u0438\u0441\u043e\u043a heat_data \u043f\u043e\u043c\u0438\u043c\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0442\u0440\u0435\u0442\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 weight (\u0438\u043c \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432 \u0441\u0440\u0435\u0434\u043d\u0438\u0435 \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u044b)<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">salary_mean = (df      .groupby('city')[['salary_mean']]      .agg('mean') )  salary_mean = coords.merge(salary_mean, on='city')  mapObj = folium.Map(location=[57.23337810789467, 48.05744173358704], zoom_start=5)  bordersStyle = {     'color': 'red',     'weight': 0.2,     'fillColor': 'grey',     'fillOpacity': 0.3 }  folium.GeoJson('russia.geojson',                name='Russia',               style_function=lambda x: bordersStyle).add_to(mapObj)  heat_data = [] for i in range(len(salary_mean)):     heat_data.append([*reversed(salary_mean['coords'][i]), salary_mean['salary_mean'][i]])  plugins.HeatMap(heat_data, radius=18, gradient={0.4: 'blue', 0.65: 'lime', 1: 'red'}).add_to(mapObj)  colormap = branca.colormap.LinearColormap(['blue', 'lime', 'red'],                                            vmin=salary_mean['salary_mean'].min(),                                            vmax=salary_mean['salary_mean'].max(),                                            caption='\u041d\u0430\u0441\u044b\u0449\u0435\u043d\u0438\u0435 \u0440\u044b\u043d\u043a\u0430 \u043f\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0439 \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u0435') colormap.add_to(mapObj)  mapObj.save('output2.html')<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/2a\/0g\/yf\/2a0gyf2wozqpoweu2aiva6h8tpu.png\" alt=\"map_salary.png\" data-src=\"https:\/\/habrastorage.org\/webt\/2a\/0g\/yf\/2a0gyf2wozqpoweu2aiva6h8tpu.png\"\/><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043b\u0438\u0441\u0442\u0438\u043d\u0433 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432 <a href=\"https:\/\/github.com\/rufous86\/hh_parcing\" rel=\"nofollow noopener noreferrer\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 Github<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/709092\/\"> https:\/\/habr.com\/ru\/post\/709092\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/2a\/0g\/yf\/2a0gyf2wozqpoweu2aiva6h8tpu.png\" data-src=\"https:\/\/habrastorage.org\/webt\/2a\/0g\/yf\/2a0gyf2wozqpoweu2aiva6h8tpu.png\"\/><br \/>  \u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439 \u0432 \u0441\u0444\u0435\u0440\u0435 Data Science \u0441 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0435\u0439 \u043f\u043e \u0433\u043e\u0440\u043e\u0434\u0430\u043c.<\/p>\n<p>  <\/p>\n<p>\u0414\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0432 3 \u044d\u0442\u0430\u043f\u0430:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439 \u0441 hh API<\/li>\n<li>\u0410\u043a\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0439 \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0438 \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430<\/li>\n<li>\u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 heatmap \u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439 \u0438 \u043f\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0439 \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e folium<br \/>\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-343509","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343509","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=343509"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343509\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=343509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=343509"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=343509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}