{"id":372966,"date":"2024-05-21T05:25:04","date_gmt":"2024-05-21T05:25:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=372966"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=372966","title":{"rendered":"<span>Python \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0433\u043e\u0434\u043e\u0432\u044b\u0445 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440 \u0432 \u041c\u043e\u0441\u043a\u0432\u0435<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><strong>Python<\/strong> &#8212; \u044d\u0442\u043e \u043c\u043e\u0449\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0433\u043e\u0434\u043e\u0432\u044b\u0445 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440 \u0432 \u041c\u043e\u0441\u043a\u0432\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u043a\u0430\u043a \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c, \u043f\u0440\u0435\u0434\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u043e\u0432\u0438\u0447\u043a\u0443 \u0432 \u044d\u0442\u043e\u043c \u0434\u0435\u043b\u0435.\u00a0<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c API, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <strong>OpenWeatherMap API<\/strong>, \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043f\u043e\u0433\u043e\u0434\u0435. <strong>OpenWeatherMap API<\/strong> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u043e \u043f\u043e\u0433\u043e\u0434\u0435 \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043c\u0438\u0440\u0443.\u00a0\u00a0<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b86\/b97\/bb3\/b86b97bb37703b137f77fd9b81b9692f.png\" alt=\"\u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u0431\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f API \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0430\u0440\u0445\u0438\u0432\u0430 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 https:\/\/rp5.ru\/\u041f\u043e\u0433\u043e\u0434\u0430_\u0432_\u041c\u043e\u0441\u043a\u0432\u0435_(\u0412\u0414\u041d\u0425)\u00a0\" title=\"\u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u0431\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f API \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0430\u0440\u0445\u0438\u0432\u0430 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 https:\/\/rp5.ru\/\u041f\u043e\u0433\u043e\u0434\u0430_\u0432_\u041c\u043e\u0441\u043a\u0432\u0435_(\u0412\u0414\u041d\u0425)\u00a0\" width=\"1368\" height=\"695\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b86\/b97\/bb3\/b86b97bb37703b137f77fd9b81b9692f.png\"\/><\/p>\n<div><figcaption>\u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u0431\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <strong>API<\/strong> \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0430\u0440\u0445\u0438\u0432\u0430 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 <a href=\"https:\/\/rp5.ru\/%D0%9F%D0%BE%D0%B3%D0%BE%D0%B4%D0%B0_%D0%B2_%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B5_(%D0%92%D0%94%D0%9D%D0%A5\" rel=\"noopener noreferrer nofollow\"><u>https:\/\/rp5.ru\/\u041f\u043e\u0433\u043e\u0434\u0430_\u0432_\u041c\u043e\u0441\u043a\u0432\u0435_(\u0412\u0414\u041d\u0425<\/u><\/a>)\u00a0<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bf8\/9bf\/baa\/bf89bfbaaf8887f93d3e99bf63958ac7.png\" width=\"1338\" height=\"727\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bf8\/9bf\/baa\/bf89bfbaaf8887f93d3e99bf63958ac7.png\"\/><\/figure>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0439 \u043f\u0435\u0440\u0438\u043e\u0434 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <strong>csv <\/strong>\u0438\u043b\u0438<strong> xls<\/strong>, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0443 \u0441\u0435\u0431\u044f \u043d\u0430 \u041f\u041a.\u00a0 \u0417\u0430\u0442\u0435\u043c, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <strong>Python<\/strong>, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <strong>Pandas<\/strong> \u0438 <strong>Plotly<\/strong>, \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. Pandas \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0430 <strong>Plotly<\/strong> &#8212; \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.\u00a0<\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>Pandas<\/strong> \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 excel, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <strong>Pandas<\/strong> \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438, \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.\u00a0<\/p>\n<pre><code class=\"python\">import numpy as np  import pandas as pd  import matplotlib.pyplot as plt import matplotlib import dash  import plotly.express as px import plotly as go   moscow_weather = pd.read_excel('C:\/\/moscow_weather.xlsx')  moscow_weather = moscow_weather.rename(columns={'\u041c\u0435\u0441\u0442\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u041c\u043e\u0441\u043a\u0432\u0435 (\u0412\u0414\u041d\u0425)':'timestamp'}) moscow_weather.info()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/26f\/75a\/dd9\/26f75add90c6f7f28b7890369f6bc46a.png\" alt=\"\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (\u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435 \u0441 \u043a\u043e\u0434\u043e\u043c). \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u201cpd.read_excel\u201d \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 \u0441 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043f\u043a. \u041f\u043e\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u0435.\u00a0  \" title=\"\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (\u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435 \u0441 \u043a\u043e\u0434\u043e\u043c). \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u201cpd.read_excel\u201d \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 \u0441 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043f\u043a. \u041f\u043e\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u0435.\u00a0  \" width=\"1008\" height=\"805\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/26f\/75a\/dd9\/26f75add90c6f7f28b7890369f6bc46a.png\"\/><\/p>\n<div><figcaption>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (\u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435 \u0441 \u043a\u043e\u0434\u043e\u043c). \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u201cpd.read_excel\u201d \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 \u0441 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043f\u043a. \u041f\u043e\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u0435.\u00a0  <\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043f\u0440\u0435\u0434\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043c \u0432\u0441\u0435 \u201c\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435\u201d \u0434\u0430\u043d\u043d\u044b\u0435 (\u0433\u043e\u0434, \u043c\u0435\u0441\u044f\u0446, \u0434\u0430\u0442\u0430, \u0432\u0440\u0435\u043c\u044f \u0438 \u0442\u0434.) \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 timestamp \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c\u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.\u00a0  <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u201cgroupby\u201d \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0433\u043e\u0434\u0430\u043c, \u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044e \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u043e\u043c, \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u043c, \u0441\u0443\u043c\u043c\u043e\u0439 \u0438 \u0441\u0440\u0435\u0434\u043d\u0438\u043c.\u00a0<\/p>\n<p>\u041d\u0430\u0439\u0434\u0435\u043c \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043e\u0442 \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u043e\u0439 \u0433\u043e\u0434\u043e\u0432\u043e\u0439 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b.\u00a0<\/p>\n<pre><code class=\"python\">#datetime split moscow_weather['timestamp'] = pd.to_datetime(moscow_weather['timestamp']) moscow_weather['year'] = moscow_weather.timestamp.dt.year moscow_weather['date'] = moscow_weather.timestamp.dt.date moscow_weather['month'] = moscow_weather.timestamp.dt.month moscow_weather['time'] = moscow_weather.timestamp.dt.time  annual_sample_temp = moscow_weather  #temperature analysis annual_sample_temp = annual_sample_temp.groupby(['year'])['T'].agg(['mean','sum', 'min', 'max']) annual_sample_temp = annual_sample_temp.reset_index()  median_min_T = annual_sample_temp['min'].median() median_max_T = annual_sample_temp['max'].median() median_avg_T = annual_sample_temp['sum'].median() median_avg_T = annual_sample_temp['mean'].median()  annual_sample_temp['rel_mean'] = (annual_sample_temp['mean']-median_avg_T)\/annual_sample_temp['mean']<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aad\/af7\/6e9\/aadaf76e9b1a28d7fda1236cb17be132.png\" width=\"756\" height=\"682\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aad\/af7\/6e9\/aadaf76e9b1a28d7fda1236cb17be132.png\"\/><\/figure>\n<p>\u0418\u0437 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043e\u0442 \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435. \u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Plotly \u0434\u043b\u044f \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f.<\/p>\n<pre><code class=\"python\">import plotly.graph_objects as go  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0433\u0440\u0430\u0444\u0438\u043a year = annual_sample_temp['year'].to_list() high = annual_sample_temp['max'].to_list() low = annual_sample_temp['min'].to_list() median = annual_sample_temp['mean'].to_list()   fig = go.Figure() # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0438 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b fig.add_trace(go.Scatter(x=year, y=high, name='Max',                          line=dict(color='firebrick', width=4))) fig.add_trace(go.Scatter(x=year, y=low, name = 'Min',                          line=dict(color='royalblue', width=4))) fig.add_trace(go.Scatter(x=year, y=median, name='Average',                          line=dict(color='grey', width=4,                               dash='dash') # dash options include 'dash', 'dot', and 'dashdot' ))  # \u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u043a\u0435\u0442 fig.update_layout(title='\u0421\u0440\u0435\u0434\u043d\u0438\u0435, \u0432\u044b\u0441\u043e\u043a\u0438\u0435 \u0438 \u043d\u0438\u0437\u043a\u0438\u0435 \u0433\u043e\u0434\u043e\u0432\u044b\u0435 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432 \u041c\u043e\u0441\u043a\u0432\u0435',                    xaxis_title='\u0413\u043e\u0434',                    yaxis_title='\u0422\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 (\u0433\u0440\u0430\u0434\u0443\u0441\u044b \u043f\u043e \u0426\u0435\u043b\u044c\u0441\u0438\u044e)',                    hovermode=\"x unified\")  fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6f4\/b75\/bd9\/6f4b75bd960cebbcfba8ed1126c4d223.png\" width=\"1047\" height=\"467\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6f4\/b75\/bd9\/6f4b75bd960cebbcfba8ed1126c4d223.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/150\/d16\/0f0\/150d160f0a91995175809fa37c88cbfe.png\" width=\"965\" height=\"480\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/150\/d16\/0f0\/150d160f0a91995175809fa37c88cbfe.png\"\/><\/figure>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u043d\u0435\u0445\u0438\u0442\u0440\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u041c\u043e\u0441\u043a\u0432\u0435 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <strong>Python<\/strong>. \u0423 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0434\u0430\u0448\u0431\u043e\u0440\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0430\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u0437\u044f\u0442\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043b\u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043a\u043d\u043e\u043f\u043e\u043a \u043b\u0435\u0433\u0435\u043d\u0434\u044b\u00a0\u0432 \u043f\u0440\u0430\u0432\u043e\u043c \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0443\u0433\u043b\u0443.  <\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/805973\/\"> https:\/\/habr.com\/ru\/articles\/805973\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><strong>Python<\/strong> &#8212; \u044d\u0442\u043e \u043c\u043e\u0449\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0433\u043e\u0434\u043e\u0432\u044b\u0445 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440 \u0432 \u041c\u043e\u0441\u043a\u0432\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u043a\u0430\u043a \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c, \u043f\u0440\u0435\u0434\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u043e\u0432\u0438\u0447\u043a\u0443 \u0432 \u044d\u0442\u043e\u043c \u0434\u0435\u043b\u0435.\u00a0<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c API, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <strong>OpenWeatherMap API<\/strong>, \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043f\u043e\u0433\u043e\u0434\u0435. <strong>OpenWeatherMap API<\/strong> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u043e \u043f\u043e\u0433\u043e\u0434\u0435 \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043c\u0438\u0440\u0443.\u00a0\u00a0<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u0431\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <strong>API<\/strong> \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0430\u0440\u0445\u0438\u0432\u0430 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 <a href=\"https:\/\/rp5.ru\/%D0%9F%D0%BE%D0%B3%D0%BE%D0%B4%D0%B0_%D0%B2_%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B5_(%D0%92%D0%94%D0%9D%D0%A5\" rel=\"noopener noreferrer nofollow\"><u>https:\/\/rp5.ru\/\u041f\u043e\u0433\u043e\u0434\u0430_\u0432_\u041c\u043e\u0441\u043a\u0432\u0435_(\u0412\u0414\u041d\u0425<\/u><\/a>)\u00a0<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><\/figure>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0439 \u043f\u0435\u0440\u0438\u043e\u0434 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <strong>csv <\/strong>\u0438\u043b\u0438<strong> xls<\/strong>, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0443 \u0441\u0435\u0431\u044f \u043d\u0430 \u041f\u041a.\u00a0 \u0417\u0430\u0442\u0435\u043c, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <strong>Python<\/strong>, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <strong>Pandas<\/strong> \u0438 <strong>Plotly<\/strong>, \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. Pandas \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0430 <strong>Plotly<\/strong> &#8212; \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.\u00a0<\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>Pandas<\/strong> \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 excel, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <strong>Pandas<\/strong> \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438, \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.\u00a0<\/p>\n<pre><code class=\"python\">import numpy as np  import pandas as pd  import matplotlib.pyplot as plt import matplotlib import dash  import plotly.express as px import plotly as go   moscow_weather = pd.read_excel('C:\/\/moscow_weather.xlsx')  moscow_weather = moscow_weather.rename(columns={'\u041c\u0435\u0441\u0442\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u041c\u043e\u0441\u043a\u0432\u0435 (\u0412\u0414\u041d\u0425)':'timestamp'}) moscow_weather.info()<\/code><\/pre>\n<figure class=\"full-width\">\n<div><figcaption>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (\u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435 \u0441 \u043a\u043e\u0434\u043e\u043c). \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u201cpd.read_excel\u201d \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 \u0441 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043f\u043a. \u041f\u043e\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u0435.\u00a0  <\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043f\u0440\u0435\u0434\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043c \u0432\u0441\u0435 \u201c\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435\u201d \u0434\u0430\u043d\u043d\u044b\u0435 (\u0433\u043e\u0434, \u043c\u0435\u0441\u044f\u0446, \u0434\u0430\u0442\u0430, \u0432\u0440\u0435\u043c\u044f \u0438 \u0442\u0434.) \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 timestamp \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c\u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.\u00a0  <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u201cgroupby\u201d \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0433\u043e\u0434\u0430\u043c, \u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044e \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u043e\u043c, \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u043c, \u0441\u0443\u043c\u043c\u043e\u0439 \u0438 \u0441\u0440\u0435\u0434\u043d\u0438\u043c.\u00a0<\/p>\n<p>\u041d\u0430\u0439\u0434\u0435\u043c \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043e\u0442 \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u043e\u0439 \u0433\u043e\u0434\u043e\u0432\u043e\u0439 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b.\u00a0<\/p>\n<pre><code class=\"python\">#datetime split moscow_weather['timestamp'] = pd.to_datetime(moscow_weather['timestamp']) moscow_weather['year'] = moscow_weather.timestamp.dt.year moscow_weather['date'] = moscow_weather.timestamp.dt.date moscow_weather['month'] = moscow_weather.timestamp.dt.month moscow_weather['time'] = moscow_weather.timestamp.dt.time  annual_sample_temp = moscow_weather  #temperature analysis annual_sample_temp = annual_sample_temp.groupby(['year'])['T'].agg(['mean','sum', 'min', 'max']) annual_sample_temp = annual_sample_temp.reset_index()  median_min_T = annual_sample_temp['min'].median() median_max_T = annual_sample_temp['max'].median() median_avg_T = annual_sample_temp['sum'].median() median_avg_T = annual_sample_temp['mean'].median()  annual_sample_temp['rel_mean'] = (annual_sample_temp['mean']-median_avg_T)\/annual_sample_temp['mean']<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<p>\u0418\u0437 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043e\u0442 \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435. \u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Plotly \u0434\u043b\u044f \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f.<\/p>\n<pre><code class=\"python\">import plotly.graph_objects as go  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0433\u0440\u0430\u0444\u0438\u043a year = annual_sample_temp['year'].to_list() high = annual_sample_temp['max'].to_list() low = annual_sample_temp['min'].to_list() median = annual_sample_temp['mean'].to_list()   fig = go.Figure() # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0438 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b fig.add_trace(go.Scatter(x=year, y=high, name='Max',                          line=dict(color='firebrick', width=4))) fig.add_trace(go.Scatter(x=year, y=low, name = 'Min',                          line=dict(color='royalblue', width=4))) fig.add_trace(go.Scatter(x=year, y=median, name='Average',                          line=dict(color='grey', width=4,                               dash='dash') # dash options include 'dash', 'dot', and 'dashdot' ))  # \u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u043a\u0435\u0442 fig.update_layout(title='\u0421\u0440\u0435\u0434\u043d\u0438\u0435, \u0432\u044b\u0441\u043e\u043a\u0438\u0435 \u0438 \u043d\u0438\u0437\u043a\u0438\u0435 \u0433\u043e\u0434\u043e\u0432\u044b\u0435 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432 \u041c\u043e\u0441\u043a\u0432\u0435',                    xaxis_title='\u0413\u043e\u0434',                    yaxis_title='\u0422\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 (\u0433\u0440\u0430\u0434\u0443\u0441\u044b \u043f\u043e \u0426\u0435\u043b\u044c\u0441\u0438\u044e)',                    hovermode=\"x unified\")  fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u043d\u0435\u0445\u0438\u0442\u0440\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u041c\u043e\u0441\u043a\u0432\u0435 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <strong>Python<\/strong>. \u0423 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0434\u0430\u0448\u0431\u043e\u0440\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0430\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u0437\u044f\u0442\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043b\u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043a\u043d\u043e\u043f\u043e\u043a \u043b\u0435\u0433\u0435\u043d\u0434\u044b\u00a0\u0432 \u043f\u0440\u0430\u0432\u043e\u043c \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0443\u0433\u043b\u0443.  <\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/805973\/\"> https:\/\/habr.com\/ru\/articles\/805973\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-372966","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/372966","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=372966"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/372966\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=372966"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=372966"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=372966"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}