From e4d0a55cd45ea9d698e353a7fffa234d89779359 Mon Sep 17 00:00:00 2001 From: Ilya Markin Date: Thu, 10 May 2018 16:59:55 +0300 Subject: [PATCH] ClickHouse practise added --- .../2018-05-07-clickhouse_practice.ipynb | 9688 +++++++++++++++++ materials/2018-05-07-retentions.ipynb | 1162 ++ 2 files changed, 10850 insertions(+) create mode 100755 materials/2018-05-07-clickhouse_practice.ipynb create mode 100755 materials/2018-05-07-retentions.ipynb diff --git a/materials/2018-05-07-clickhouse_practice.ipynb b/materials/2018-05-07-clickhouse_practice.ipynb new file mode 100755 index 0000000..c4d5a7d --- /dev/null +++ b/materials/2018-05-07-clickhouse_practice.ipynb @@ -0,0 +1,9688 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## ClickHouse для аналитики" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Установка ClickHouse\n", + "\n", + "ClickHouse можно установить на Linux (подробно про установку написано в документации https://clickhouse.yandex/).\n", + "\n", + "На Windows или Mac можно запустить ClickHouse под Docker'ом: первая команда поднимает clickhouse-server на порту 8123, а вторая - позволяет подключиться к консольному ClickHouse клиенту.\n", + "\n", + "```docker run -d --name clickhouse-server --publish=8123:8123 --publish=9000:9000 yandex/clickhouse-server\n", + "docker run -it --rm --link clickhouse-server:9000 yandex/clickhouse-client --host clickhouse-server```\n", + "\n", + "\n", + "## Загружаем данные\n", + "\n", + "У Метрики и AppMetrica есть функциональность Logs API, которая позволяет получить сырые данные по пользовательским просмотрам страниц и сессиям. Мы для примера будем использовать данные с демо-счетчика, который стоит на сайт Help'a Яндекс.Метрики и доступен всем желающим.\n", + "\n", + "**Полезные ссылки**\n", + "* [Logs API AppMetrica](https://tech.yandex.ru/appmetrica/doc/mobile-api/logs/about-docpage/)\n", + "* [Logs API Метрика](https://tech.yandex.ru/metrika/doc/api2/logs/intro-docpage/)\n", + "* [Скрипт для интеграции Logs API Метрики с ClickHouse](https://tech.yandex.ru/metrika/doc/api2/logs/clickhouse-integration-docpage/)\n", + "* [Framework для интеграции Logs API AppMetrica c ClickHouse]()" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/vnd.plotly.v1+html": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "import requests\n", + "import pandas as pd\n", + "import io\n", + "import os\n", + "import time\n", + "pd.set_option('display.max_colwidth', 5000)\n", + "\n", + "\n", + "from plotly import __version__\n", + "from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot\n", + "from plotly import graph_objs as go\n", + "import plotly\n", + "\n", + "init_notebook_mode(connected = True)\n", + "\n", + "\n", + "\n", + "def plotly_line_df(df, title = '', filename = None):\n", + " data = []\n", + " \n", + " for column in df.columns:\n", + " trace = go.Scatter(\n", + " x = df.index,\n", + " y = df[column],\n", + " mode = 'lines',\n", + " name = column\n", + " )\n", + " data.append(trace)\n", + " \n", + " layout = dict(title = title)\n", + " fig = dict(data = data, layout = layout)\n", + " iplot(fig, show_link = False)\n", + " if filename is not None:\n", + " plotly.offline.plot(fig, show_link = False, filename = filename)\n", + " \n", + "def plotly_bar_df(df, title = '', filename = None, index = None):\n", + " data = []\n", + " \n", + " if index is None:\n", + " for column in df.columns:\n", + " trace = go.Bar(\n", + " x = df.index,\n", + " y = df[column],\n", + " name = column\n", + " )\n", + " data.append(trace)\n", + " else:\n", + " for column in df.columns:\n", + " trace = go.Bar(\n", + " x = index,\n", + " y = df.loc[index][column],\n", + " name = column\n", + " )\n", + " data.append(trace)\n", + " \n", + " layout = dict(title = title)\n", + " fig = dict(data = data, layout = layout)\n", + " iplot(fig, show_link = False)\n", + " if filename is not None:\n", + " plotly.offline.plot(fig, show_link = False, filename = filename)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false, + "scrolled": false + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/IPython/core/interactiveshell.py:2698: DtypeWarning:\n", + "\n", + "Columns (25) have mixed types. Specify dtype option on import or set low_memory=False.\n", + "\n", + "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/IPython/core/interactiveshell.py:2698: DtypeWarning:\n", + "\n", + "Columns (16) have mixed types. Specify dtype option on import or set low_memory=False.\n", + "\n", + "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/IPython/core/interactiveshell.py:2698: DtypeWarning:\n", + "\n", + "Columns (31) have mixed types. Specify dtype option on import or set low_memory=False.\n", + "\n" + ] + } + ], + "source": [ + "visits_tmp_dfs = []\n", + "\n", + "for filename in os.listdir('demo_counter_data'):\n", + " if filename.startswith('visits'):\n", + " visits_tmp_dfs.append(pd.read_csv('./demo_counter_data/' + filename, sep = '\\t'))" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "visits_df = pd.concat(visits_tmp_dfs)" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "visits_columns = [\n", + " 'ym:s:bounce',\n", + " 'ym:s:browser',\n", + " 'ym:s:browserMajorVersion',\n", + " 'ym:s:browserMinorVersion',\n", + " 'ym:s:clientID',\n", + " 'ym:s:date',\n", + " 'ym:s:dateTime',\n", + " 'ym:s:goalsID',\n", + " 'ym:s:deviceCategory',\n", + " 'ym:s:goalsDateTime',\n", + " 'ym:s:ipAddress',\n", + " 'ym:s:isNewUser',\n", + " 'ym:s:lastAdvEngine',\n", + " 'ym:s:lastReferalSource',\n", + " 'ym:s:lastSearchEngine',\n", + " 'ym:s:lastSearchEngineRoot',\n", + " 'ym:s:lastSocialNetwork',\n", + " 'ym:s:lastSocialNetworkProfile',\n", + " 'ym:s:lastTrafficSource',\n", + " 'ym:s:mobilePhone',\n", + " 'ym:s:mobilePhoneModel',\n", + " 'ym:s:operatingSystem',\n", + " 'ym:s:operatingSystemRoot',\n", + " 'ym:s:pageViews',\n", + " 'ym:s:params',\n", + " 'ym:s:referer',\n", + " 'ym:s:regionCity',\n", + " 'ym:s:regionCountry',\n", + " 'ym:s:screenHeight',\n", + " 'ym:s:screenWidth',\n", + " 'ym:s:startURL',\n", + " 'ym:s:endURL',\n", + " 'ym:s:visitDuration',\n", + " 'ym:s:visitID',\n", + " 'ym:s:watchIDs'\n", + "]\n", + "\n", + "ch_types = {\n", + " 'ym:s:bounce': 'UInt8',\n", + " 'ym:s:browser': 'String',\n", + " 'ym:s:browserMajorVersion': 'UInt16',\n", + " 'ym:s:browserMinorVersion': 'UInt16',\n", + " 'ym:s:clientID': 'UInt64',\n", + " 'ym:s:date': 'Date',\n", + " 'ym:s:dateTime': 'DateTime',\n", + " 'ym:s:deviceCategory': 'String',\n", + " 'ym:s:endURL': 'String',\n", + " 'ym:s:goalsDateTime': 'Array(DateTime)',\n", + " 'ym:s:goalsID': 'Array(UInt32)',\n", + " 'ym:s:ipAddress': 'String',\n", + " 'ym:s:isNewUser': 'UInt8',\n", + " 'ym:s:lastAdvEngine': 'String',\n", + " 'ym:s:lastReferalSource': 'String',\n", + " 'ym:s:lastSearchEngine': 'String',\n", + " 'ym:s:lastSearchEngineRoot': 'String',\n", + " 'ym:s:lastSocialNetwork': 'String',\n", + " 'ym:s:lastSocialNetworkProfile': 'String',\n", + " 'ym:s:lastTrafficSource': 'String',\n", + " 'ym:s:mobilePhone': 'String',\n", + " 'ym:s:mobilePhoneModel': 'String',\n", + " 'ym:s:operatingSystem': 'String',\n", + " 'ym:s:operatingSystemRoot': 'String',\n", + " 'ym:s:pageViews': 'Int32',\n", + " 'ym:s:params': 'Array(String)',\n", + " 'ym:s:referer': 'String',\n", + " 'ym:s:regionCity': 'String',\n", + " 'ym:s:regionCountry': 'String',\n", + " 'ym:s:screenHeight': 'UInt16',\n", + " 'ym:s:screenWidth': 'UInt16',\n", + " 'ym:s:startURL': 'String',\n", + " 'ym:s:visitDuration': 'UInt32',\n", + " 'ym:s:visitID': 'UInt64',\n", + " 'ym:s:watchIDs': 'Array(UInt64)'\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "# visits_df.VisitID.head(10)" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "columns = []\n", + "\n", + "for param in visits_columns:\n", + " param_name = param.replace('ym:s:', '')[0].capitalize() + param.replace('ym:s:', '')[1:]\n", + " param_type = ch_types[param]\n", + " columns.append('%s %s' % (param_name, param_type))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "На этот раз создадим таблицу с ENGINE MergeTree. В ClickHouse есть целое семейство движков MergeTree - Collapsing, Summing, Replacing, Replicated и т.д.\n", + "MergeTree - самая простая версия, которая поддерживает индексирование и семплирование. " + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "HOST = 'http://localhost:8123/'\n", + "def get_clickhouse_data(query, host = HOST, connection_timeout = 1500):\n", + " NUMBER_OF_TRIES = 30\n", + " DELAY = 10\n", + " \n", + " for i in range(NUMBER_OF_TRIES):\n", + " r = requests.post(host, params = {'timeout_before_checking_execution_speed': 120, 'max_execution_time': 6000}\n", + " , timeout = connection_timeout, data = query)\n", + " if r.status_code == 200:\n", + " return r.text\n", + " else:\n", + " print('ATTENTION: try #%d failed' % i)\n", + " if i != (NUMBER_OF_TRIES-1):\n", + " print(query)\n", + " print(r.text)\n", + " time.sleep(DELAY*(i+1))\n", + " else:\n", + " raise ValueError(r.text)" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "''" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = 'DROP TABLE IF EXISTS visits_all'\n", + "get_clickhouse_data(q)\n", + "\n", + "q = '''\n", + " CREATE TABLE visits_all ({columns}) \n", + " ENGINE = MergeTree(Date, intHash32(ClientID), (Date, intHash32(ClientID)), 8192)\n", + "'''.format(columns = ', '.join(columns))\n", + "\n", + "get_clickhouse_data(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "visits_df['ym:s:browserMinorVersion'] = list(map(int, list(visits_df['ym:s:browserMinorVersion'].fillna(0))))\n", + "visits_df['ym:s:visitID'] = list(map(int, list(visits_df['ym:s:visitID'].fillna(0))))" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "visits_df = visits_df.fillna('')" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "(1222286, 57)" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "visits_df.shape" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "visits_df = visits_df[visits_columns]" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "100000\n", + "200000\n", + "300000\n", + "400000\n", + "500000\n", + "600000\n", + "700000\n", + "800000\n", + "900000\n", + "1000000\n", + "1100000\n", + "1200000\n", + "CPU times: user 4min 58s, sys: 4.21 s, total: 5min 2s\n", + "Wall time: 5min 13s\n" + ] + } + ], + "source": [ + "%%time\n", + "values = []\n", + "values.append('\\t'.join(visits_columns))\n", + "\n", + "for i in range(visits_df.shape[0]):\n", + " if i % 100000 == 0:\n", + " print(i)\n", + " values.append('\\t'.join(map(str, visits_df.iloc[i].values)))" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "HOST = 'http://localhost:8123/'\n", + "def upload(table, content, host=HOST):\n", + " '''Uploads data to table in ClickHous'''\n", + " content = content.encode('utf-8')\n", + " query_dict = {\n", + " 'query': 'INSERT INTO ' + table + ' FORMAT TabSeparatedWithNames '\n", + " }\n", + " r = requests.post(host, data=content, params=query_dict)\n", + " result = r.text\n", + " if r.status_code == 200:\n", + " return result\n", + " else:\n", + " raise ValueError(r.text)" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "CPU times: user 4.6 s, sys: 17.2 s, total: 21.8 s\n", + "Wall time: 1min 56s\n" + ] + }, + { + "data": { + "text/plain": [ + "''" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "%%time\n", + "upload('visits_all', '\\n'.join(values))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Простые SELECT запросы" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Для проверки попробуем сделать простой SELECT нескольких столбцов.\n", + "\n", + "ClickHouse - столбцовая СУБД, то есть, данные хранятся по колонкам и сжатие так же происходит по столбцам. Типичный сценарий работы с ClickHouse - в запросе участвует небольшое количество колонок, но относительно большое количество строк. Поэтому делать `SELECT *` не рекомендуется." + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1461908033834334420\t2016-10-01 16:17:26\thttps://yandex.ru/support/metrika/troubleshooting/access-qanda.xml\t['{\"login\":true}','{\"login\":true}']\n", + "1469802107825757398\t2016-10-01 23:33:48\thttps://yandex.ru/support/metrika/\t[]\n", + "1474720846487102126\t2016-10-01 06:32:42\thttps://yandex.ru/support/metrika/data/e-commerce.xml\t[]\n", + "1472198459221414089\t2016-10-01 20:35:32\thttps://yandex.ru/support/metrika/troubleshooting.xml\t['{\"login\":true}','{\"login\":true}']\n", + "1467057414858508354\t2016-10-01 00:30:19\thttps://yandex.ru/support/metrika/general/goals.xml\t[]\n", + "1475350611504457143\t2016-10-01 23:52:39\thttps://yandex.ru/support/metrika/general/access.xml\t[]\n", + "1466280569981691679\t2016-10-01 00:21:18\thttps://yandex.ru/support/metrika/reports/add-goals.xml\t[]\n", + "1474974033103072669\t2016-10-01 09:58:06\thttps://yandex.ru/support/metrika/general/glossary.xml\t[]\n", + "1475329004492101252\t2016-10-01 16:37:01\thttps://yandex.ru/support/metrika/\t[]\n", + "147261681766100953\t2016-10-01 17:36:57\thttps://yandex.ru/support/metrika/sources/sources-summary.xml\t[]\n", + "\n" + ] + } + ], + "source": [ + "q = '''\n", + " SELECT \n", + " ClientID,\n", + " DateTime,\n", + " StartURL, \n", + " Params\n", + " FROM visits_all\n", + " LIMIT 10\n", + "'''\n", + "\n", + "print(get_clickhouse_data(q))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Давайте попробуем сделать вывод более пригодным для работы и преобразуем вывод ClickHouse в `pandas.DataFrame`." + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "def get_clickhouse_df(query, host = HOST, connection_timeout = 1500):\n", + " data = get_clickhouse_data(query, host, connection_timeout) \n", + " df = pd.read_csv(io.StringIO(data), sep = '\\t')\n", + " return df" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "На самом деле, можно сделать еще удобнее, указав `FORMAT TabSeparatedWithNames` - тогда в ответе придет также строке headers, которая будет распаршена как название колонок `DataFrame`." + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
ClientIDDateTimeStartURLParams
014619080338343344202016-10-01 16:17:26https://yandex.ru/support/metrika/troubleshooting/access-qanda.xml['{\"login\":true}','{\"login\":true}']
114698021078257573982016-10-01 23:33:48https://yandex.ru/support/metrika/[]
214747208464871021262016-10-01 06:32:42https://yandex.ru/support/metrika/data/e-commerce.xml[]
314721984592214140892016-10-01 20:35:32https://yandex.ru/support/metrika/troubleshooting.xml['{\"login\":true}','{\"login\":true}']
414670574148585083542016-10-01 00:30:19https://yandex.ru/support/metrika/general/goals.xml[]
514753506115044571432016-10-01 23:52:39https://yandex.ru/support/metrika/general/access.xml[]
614662805699816916792016-10-01 00:21:18https://yandex.ru/support/metrika/reports/add-goals.xml[]
714749740331030726692016-10-01 09:58:06https://yandex.ru/support/metrika/general/glossary.xml[]
814753290044921012522016-10-01 16:37:01https://yandex.ru/support/metrika/[]
91472616817661009532016-10-01 17:36:57https://yandex.ru/support/metrika/sources/sources-summary.xml[]
\n", + "
" + ], + "text/plain": [ + " ClientID DateTime \\\n", + "0 1461908033834334420 2016-10-01 16:17:26 \n", + "1 1469802107825757398 2016-10-01 23:33:48 \n", + "2 1474720846487102126 2016-10-01 06:32:42 \n", + "3 1472198459221414089 2016-10-01 20:35:32 \n", + "4 1467057414858508354 2016-10-01 00:30:19 \n", + "5 1475350611504457143 2016-10-01 23:52:39 \n", + "6 1466280569981691679 2016-10-01 00:21:18 \n", + "7 1474974033103072669 2016-10-01 09:58:06 \n", + "8 1475329004492101252 2016-10-01 16:37:01 \n", + "9 147261681766100953 2016-10-01 17:36:57 \n", + "\n", + " StartURL \\\n", + "0 https://yandex.ru/support/metrika/troubleshooting/access-qanda.xml \n", + "1 https://yandex.ru/support/metrika/ \n", + "2 https://yandex.ru/support/metrika/data/e-commerce.xml \n", + "3 https://yandex.ru/support/metrika/troubleshooting.xml \n", + "4 https://yandex.ru/support/metrika/general/goals.xml \n", + "5 https://yandex.ru/support/metrika/general/access.xml \n", + "6 https://yandex.ru/support/metrika/reports/add-goals.xml \n", + "7 https://yandex.ru/support/metrika/general/glossary.xml \n", + "8 https://yandex.ru/support/metrika/ \n", + "9 https://yandex.ru/support/metrika/sources/sources-summary.xml \n", + "\n", + " Params \n", + "0 ['{\"login\":true}','{\"login\":true}'] \n", + "1 [] \n", + "2 [] \n", + "3 ['{\"login\":true}','{\"login\":true}'] \n", + "4 [] \n", + "5 [] \n", + "6 [] \n", + "7 [] \n", + "8 [] \n", + "9 [] " + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT \n", + " ClientID,\n", + " DateTime,\n", + " StartURL, \n", + " Params\n", + " FROM visits_all\n", + " LIMIT 10\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Как и в стандартном SQL, в ClickHouse можно указать порядок вывода с помощью `ORDER BY` и число строк, которые должны быть в выводе с помощью `LIMIT`.\n", + "\n", + "Также в секции `WHERE` можно указать дополнительные фильтры." + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
ClientIDDateTimeStartURLParams
002016-10-01 06:12:13https://yandex.ru/support/metrika/troubleshooting.xml[]
102016-10-01 18:15:13https://yandex.ru/support/metrika/troubleshooting.xml[]
202016-10-01 19:11:30https://yandex.ru/support/metrika/troubleshooting.xml[]
302016-10-02 11:32:10https://yandex.ru/support/metrika/objects/reachgoal.xml[]
402016-10-03 15:35:56https://yandex.ru/support/metrika/objects/reachgoal.xml[]
502016-10-03 21:24:32https://yandex.ru/support/metrika/webvisor/about-webvisor.xml[]
602016-10-04 01:28:11https://yandex.ru/support/metrika/webvisor/about-webvisor.xml[]
702016-10-04 07:45:06https://yandex.ru/support/metrika/webvisor/about-webvisor.xml[]
802016-10-04 09:25:04https://yandex.ru/support/metrika/general/glossary.xml[]
902016-10-04 09:25:05https://yandex.ru/support/metrika/general/glossary.xml[]
\n", + "
" + ], + "text/plain": [ + " ClientID DateTime \\\n", + "0 0 2016-10-01 06:12:13 \n", + "1 0 2016-10-01 18:15:13 \n", + "2 0 2016-10-01 19:11:30 \n", + "3 0 2016-10-02 11:32:10 \n", + "4 0 2016-10-03 15:35:56 \n", + "5 0 2016-10-03 21:24:32 \n", + "6 0 2016-10-04 01:28:11 \n", + "7 0 2016-10-04 07:45:06 \n", + "8 0 2016-10-04 09:25:04 \n", + "9 0 2016-10-04 09:25:05 \n", + "\n", + " StartURL Params \n", + "0 https://yandex.ru/support/metrika/troubleshooting.xml [] \n", + "1 https://yandex.ru/support/metrika/troubleshooting.xml [] \n", + "2 https://yandex.ru/support/metrika/troubleshooting.xml [] \n", + "3 https://yandex.ru/support/metrika/objects/reachgoal.xml [] \n", + "4 https://yandex.ru/support/metrika/objects/reachgoal.xml [] \n", + "5 https://yandex.ru/support/metrika/webvisor/about-webvisor.xml [] \n", + "6 https://yandex.ru/support/metrika/webvisor/about-webvisor.xml [] \n", + "7 https://yandex.ru/support/metrika/webvisor/about-webvisor.xml [] \n", + "8 https://yandex.ru/support/metrika/general/glossary.xml [] \n", + "9 https://yandex.ru/support/metrika/general/glossary.xml [] " + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT \n", + " ClientID,\n", + " DateTime,\n", + " StartURL, \n", + " Params\n", + " FROM visits_all\n", + " ORDER BY ClientID, DateTime\n", + " LIMIT 10\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
ClientIDDateTimeStartURLParams
014807115806392017-01-21 19:06:42https://yandex.ru/support/metrika/troubleshooting.xml[]
1147789248252772016-10-31 08:43:38https://yandex.ru/support/metrika/[]
2148007706441172016-12-03 07:41:10https://yandex.ru/support/metrika/data/e-commerce.xml[]
3148654626047142017-02-25 00:07:51https://yandex.ru/support/metrika/general/glossary.xml[]
4148798403394342017-02-25 03:58:54https://yandex.ru/support/metrika/data/visit-params.xml[]
5149211262363802017-05-03 22:22:47https://yandex.ru/support/metrika/visitors/loyalty.xml[]
6149518122458122017-07-01 19:37:52https://forms.yandex.ru/surveys/1705/?iframe=1&theme=support&title=Начало работы&lang=ru&path=/metrika/quick-start.xml&lang=ru&referer=https:%2F%2Fwww.google.ru%2F&url=https:%2F%2Fyandex.ru%2Fsupport%2Fmetrika%2Fquick-start.xml&feedback_sid=3342194641495035808&mobile=no&fromhost=yandex.ru&service=metrika&login=centerchs&owner=yes&base=/support[]
7150539241653192017-09-14 15:33:56https://yandex.ru/support/metrika/general/access.xml[]
81462369546333842017-04-10 16:18:39https://yandex.ru/support/metrika/general/regexp.xml[]
91464553132483692017-05-18 07:44:07https://yandex.ru/support/metrika/code/counter-initialize.xml[]
\n", + "
" + ], + "text/plain": [ + " ClientID DateTime \\\n", + "0 1480711580639 2017-01-21 19:06:42 \n", + "1 14778924825277 2016-10-31 08:43:38 \n", + "2 14800770644117 2016-12-03 07:41:10 \n", + "3 14865462604714 2017-02-25 00:07:51 \n", + "4 14879840339434 2017-02-25 03:58:54 \n", + "5 14921126236380 2017-05-03 22:22:47 \n", + "6 14951812245812 2017-07-01 19:37:52 \n", + "7 15053924165319 2017-09-14 15:33:56 \n", + "8 146236954633384 2017-04-10 16:18:39 \n", + "9 146455313248369 2017-05-18 07:44:07 \n", + "\n", + " StartURL \\\n", + "0 https://yandex.ru/support/metrika/troubleshooting.xml \n", + "1 https://yandex.ru/support/metrika/ \n", + "2 https://yandex.ru/support/metrika/data/e-commerce.xml \n", + "3 https://yandex.ru/support/metrika/general/glossary.xml \n", + "4 https://yandex.ru/support/metrika/data/visit-params.xml \n", + "5 https://yandex.ru/support/metrika/visitors/loyalty.xml \n", + "6 https://forms.yandex.ru/surveys/1705/?iframe=1&theme=support&title=Начало работы&lang=ru&path=/metrika/quick-start.xml&lang=ru&referer=https:%2F%2Fwww.google.ru%2F&url=https:%2F%2Fyandex.ru%2Fsupport%2Fmetrika%2Fquick-start.xml&feedback_sid=3342194641495035808&mobile=no&fromhost=yandex.ru&service=metrika&login=centerchs&owner=yes&base=/support \n", + "7 https://yandex.ru/support/metrika/general/access.xml \n", + "8 https://yandex.ru/support/metrika/general/regexp.xml \n", + "9 https://yandex.ru/support/metrika/code/counter-initialize.xml \n", + "\n", + " Params \n", + "0 [] \n", + "1 [] \n", + "2 [] \n", + "3 [] \n", + "4 [] \n", + "5 [] \n", + "6 [] \n", + "7 [] \n", + "8 [] \n", + "9 [] " + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT \n", + " ClientID,\n", + " DateTime,\n", + " StartURL, \n", + " Params\n", + " FROM visits_all\n", + " WHERE (ClientID != 0) AND empty(Params)\n", + " ORDER BY ClientID, DateTime\n", + " LIMIT 10\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Как и в классическом SQL для того, чтобы получить только уникальные различающиеся строки, нужно использовать ключевое слово `DISTINCT`.\n", + "\n", + "Посмотрим на то, какие есть значение `Params`." + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Params
0['{\"login\":true}','{\"login\":true}']
1[]
2['{\"login\":true}']
3['{\"login\":false}']
4['{\"login\":false}','{\"login\":false}']
5['{\"login\":true}','{\"login\":true}','{\"login\":true}']
6['{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}']
7['{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}']
8['{\"login\":false}','{\"login\":false}','{\"login\":false}']
9['{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}']
10['{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}']
11['{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}']
12['{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}']
13['{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}']
14['{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}']
15['{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}']
16['{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}']
17['{\"sessionLogin\":true,\"login\":true}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}']
18['{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}']
19['{\"sessionLogin\":true,\"login\":true}','{\"login\":true}','{\"login\":false}']
\n", + "
" + ], + "text/plain": [ + " Params\n", + "0 ['{\"login\":true}','{\"login\":true}']\n", + "1 []\n", + "2 ['{\"login\":true}']\n", + "3 ['{\"login\":false}']\n", + "4 ['{\"login\":false}','{\"login\":false}']\n", + "5 ['{\"login\":true}','{\"login\":true}','{\"login\":true}']\n", + "6 ['{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}']\n", + "7 ['{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}']\n", + "8 ['{\"login\":false}','{\"login\":false}','{\"login\":false}']\n", + "9 ['{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}']\n", + "10 ['{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}']\n", + "11 ['{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}']\n", + "12 ['{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}']\n", + "13 ['{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}']\n", + "14 ['{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}']\n", + "15 ['{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}']\n", + "16 ['{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}','{\"login\":true}']\n", + "17 ['{\"sessionLogin\":true,\"login\":true}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}']\n", + "18 ['{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}','{\"login\":false}']\n", + "19 ['{\"sessionLogin\":true,\"login\":true}','{\"login\":true}','{\"login\":false}']" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " DISTINCT Params\n", + " FROM visits_all\n", + " LIMIT 20\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Аггрегатные функции\n", + "\n", + "Перейдем к агрегатным функциям и посчитаем число сессий, просмотров и пользователей.\n", + "`count` использует для подсчета числа строк, `sum` - для суммы, `uniq` - для числа уникальных значений.\n", + "Стоит помнить, что по default'у `uniq` выдает приближенную оценку, но есть и функция для точного подсчета `uniqExact`." + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
visitshitsusers
012222863293781620355
\n", + "
" + ], + "text/plain": [ + " visits hits users\n", + "0 1222286 3293781 620355" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as visits,\n", + " sum(PageViews) as hits,\n", + " uniq(ClientID) as users\n", + " FROM visits_all\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Посчитаем все те же показатели для разных браузеров.\n", + "Если указать `WITH TOTALS`, то БД также посчитает суммарные значения." + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
visitshitsusersbrowser
06897551878324343790chrome
114583840544676274firefox
216920847862173004yandex_browser
37916519650037949opera
4303917090621679chromemobile
5244675067217839safari_mobile
6336179046616835safari
712048317489216msie
810987289217046edge
95971127784432android_browser
1012222863293781620355NaN
\n", + "
" + ], + "text/plain": [ + " visits hits users browser\n", + "0 689755 1878324 343790 chrome\n", + "1 145838 405446 76274 firefox\n", + "2 169208 478621 73004 yandex_browser\n", + "3 79165 196500 37949 opera\n", + "4 30391 70906 21679 chromemobile\n", + "5 24467 50672 17839 safari_mobile\n", + "6 33617 90466 16835 safari\n", + "7 12048 31748 9216 msie\n", + "8 10987 28921 7046 edge\n", + "9 5971 12778 4432 android_browser\n", + "10 1222286 3293781 620355 NaN" + ] + }, + "execution_count": 41, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as visits,\n", + " sum(PageViews) as hits,\n", + " uniq(ClientID) as users,\n", + " Browser as browser\n", + " FROM visits_all\n", + " GROUP BY browser\n", + " WITH TOTALS\n", + " ORDER BY users DESC\n", + " LIMIT 10\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Отфильтруем браузеры с очень маленькой аудиторией, добавив фильтр в секцию `HAVING`. В `HAVING` указываются фильтрации на значение агрегатных функций." + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
visitshitsusersbrowser
06897551878324343790chrome
114583840544676274firefox
216920847862173004yandex_browser
37916519650037949opera
4303917090621679chromemobile
5244675067217839safari_mobile
6336179046616835safari
\n", + "
" + ], + "text/plain": [ + " visits hits users browser\n", + "0 689755 1878324 343790 chrome\n", + "1 145838 405446 76274 firefox\n", + "2 169208 478621 73004 yandex_browser\n", + "3 79165 196500 37949 opera\n", + "4 30391 70906 21679 chromemobile\n", + "5 24467 50672 17839 safari_mobile\n", + "6 33617 90466 16835 safari" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as visits,\n", + " sum(PageViews) as hits,\n", + " uniq(ClientID) as users,\n", + " Browser as browser\n", + " FROM visits_all\n", + " GROUP BY browser\n", + " HAVING users >= 10000\n", + " ORDER BY users DESC\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "В ряде случаев очень полезны бывают агрегатные функции `argMin` и `argMax`, которые позволяют получить аргумент, который соответствует минимальному или максимальному значению функции.\n", + "Для примера посмотрим с каких источников трафика приходили впервые клиенты на наш сайт." + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
ClientIDTraficSourceTime
01492082334667013933organic2017-06-15 18:19:42
11472637049942465862referral2016-10-02 21:37:09
21479801973409171068organic2016-12-19 08:31:45
31504627014257703686direct2017-09-07 13:28:18
41476794766215335835referral2016-10-18 17:06:25
51472227461958972179referral2016-12-22 18:38:33
61485823812347745446organic2017-02-15 15:31:05
71476954727667706155organic2017-01-24 15:42:37
81481930425910644568referral2017-01-10 19:22:56
91497376107135577420organic2017-06-17 21:18:14
\n", + "
" + ], + "text/plain": [ + " ClientID TraficSource Time\n", + "0 1492082334667013933 organic 2017-06-15 18:19:42\n", + "1 1472637049942465862 referral 2016-10-02 21:37:09\n", + "2 1479801973409171068 organic 2016-12-19 08:31:45\n", + "3 1504627014257703686 direct 2017-09-07 13:28:18\n", + "4 1476794766215335835 referral 2016-10-18 17:06:25\n", + "5 1472227461958972179 referral 2016-12-22 18:38:33\n", + "6 1485823812347745446 organic 2017-02-15 15:31:05\n", + "7 1476954727667706155 organic 2017-01-24 15:42:37\n", + "8 1481930425910644568 referral 2017-01-10 19:22:56\n", + "9 1497376107135577420 organic 2017-06-17 21:18:14" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT \n", + " ClientID,\n", + " argMin(LastTrafficSource, DateTime) as TraficSource,\n", + " min(DateTime) as Time\n", + " FROM visits_all SAMPLE 1/10\n", + " GROUP BY ClientID \n", + " LIMIT 10\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Модификатор агрегатных функций -If\n", + "\n", + "К любой агрегатной функции можно добавить суффикс -If и тогда у функции добавится еще один параметр - условие и при подсчете значения будут учитываться только те строки, которые удовлетворяют условию.\n", + "\n", + "Давайте посчитаем долю мобильных устройств в разных странах по пользователям и трафику." + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
total_visitsdevice
011428371
1648452
2145273
3774
\n", + "
" + ], + "text/plain": [ + " total_visits device\n", + "0 1142837 1\n", + "1 64845 2\n", + "2 14527 3\n", + "3 77 4" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as total_visits,\n", + " DeviceCategory as device\n", + " FROM visits_all\n", + " GROUP BY device\n", + " ORDER BY total_visits DESC\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
total_visitsmobile_visitstotal_usersmobile_usersmobile_visits_sharemobile_users_sharecountry
097807596557450758849966198.7298.44Russia
19089790042480064748099.0698.90Ukraine
25115950716241802389499.1398.82Belarus
343557435374045404099.9599.88NaN
413852137688580850699.3999.14Kazakhstan
5364335662791272597.8997.64Turkey
6351534732178214098.8198.26Germany
7330832642295225398.6798.17United States
8299529231897187297.6098.68Moldova
9199519831328132199.4099.47Netherlands
\n", + "
" + ], + "text/plain": [ + " total_visits mobile_visits total_users mobile_users \\\n", + "0 978075 965574 507588 499661 \n", + "1 90897 90042 48006 47480 \n", + "2 51159 50716 24180 23894 \n", + "3 43557 43537 4045 4040 \n", + "4 13852 13768 8580 8506 \n", + "5 3643 3566 2791 2725 \n", + "6 3515 3473 2178 2140 \n", + "7 3308 3264 2295 2253 \n", + "8 2995 2923 1897 1872 \n", + "9 1995 1983 1328 1321 \n", + "\n", + " mobile_visits_share mobile_users_share country \n", + "0 98.72 98.44 Russia \n", + "1 99.06 98.90 Ukraine \n", + "2 99.13 98.82 Belarus \n", + "3 99.95 99.88 NaN \n", + "4 99.39 99.14 Kazakhstan \n", + "5 97.89 97.64 Turkey \n", + "6 98.81 98.26 Germany \n", + "7 98.67 98.17 United States \n", + "8 97.60 98.68 Moldova \n", + "9 99.40 99.47 Netherlands " + ] + }, + "execution_count": 45, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as total_visits,\n", + " countIf(DeviceCategory IN ('2', '1')) as mobile_visits,\n", + " uniq(ClientID) as total_users,\n", + " uniqIf(ClientID, DeviceCategory IN ('1', '2')) as mobile_users,\n", + " round(100*mobile_visits/total_visits, 2) as mobile_visits_share,\n", + " round(100*mobile_users/total_users, 2) as mobile_users_share,\n", + " RegionCountry as country\n", + " FROM visits_all\n", + " GROUP BY country\n", + " ORDER BY total_visits DESC\n", + " LIMIT 10\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Семплирование" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "CPU times: user 5.04 ms, sys: 1.48 ms, total: 6.52 ms\n", + "Wall time: 201 ms\n" + ] + } + ], + "source": [ + "%%time\n", + "q = '''\n", + " SELECT \n", + " uniq(ClientID) as users,\n", + " Date\n", + " FROM visits_all\n", + " GROUP BY Date\n", + " ORDER BY Date\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "df1 = get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "CPU times: user 5.78 ms, sys: 1.47 ms, total: 7.24 ms\n", + "Wall time: 87.1 ms\n" + ] + } + ], + "source": [ + "%%time\n", + "q = '''\n", + " SELECT \n", + " 10*uniq(ClientID) as users,\n", + " Date\n", + " FROM visits_all SAMPLE 1/10\n", + " GROUP BY Date\n", + " ORDER BY Date\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "df2 = get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
usersusers_sample
Date
2016-10-0114821480
2016-10-0215311300
2016-10-0336523600
2016-10-0442204160
2016-10-0542174280
2016-10-0640694000
2016-10-0735963660
2016-10-0815901560
2016-10-0916391720
2016-10-1038153620
2016-10-1138993550
2016-10-1238563770
2016-10-1338533880
2016-10-1435163600
2016-10-1515481660
2016-10-1616321450
2016-10-1740064320
2016-10-1838803730
2016-10-1939263870
2016-10-2037983610
\n", + "
" + ], + "text/plain": [ + " users users_sample\n", + "Date \n", + "2016-10-01 1482 1480\n", + "2016-10-02 1531 1300\n", + "2016-10-03 3652 3600\n", + "2016-10-04 4220 4160\n", + "2016-10-05 4217 4280\n", + "2016-10-06 4069 4000\n", + "2016-10-07 3596 3660\n", + "2016-10-08 1590 1560\n", + "2016-10-09 1639 1720\n", + "2016-10-10 3815 3620\n", + "2016-10-11 3899 3550\n", + "2016-10-12 3856 3770\n", + "2016-10-13 3853 3880\n", + "2016-10-14 3516 3600\n", + "2016-10-15 1548 1660\n", + "2016-10-16 1632 1450\n", + "2016-10-17 4006 4320\n", + "2016-10-18 3880 3730\n", + "2016-10-19 3926 3870\n", + "2016-10-20 3798 3610" + ] + }, + "execution_count": 48, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df1.set_index('Date').join(df2.set_index('Date'), rsuffix = '_sample').head(20)" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "def load_users_iter(i, N = 10):\n", + " q = '''\n", + " SELECT \n", + " uniq(ClientID) as users,\n", + " Date\n", + " FROM visits_all SAMPLE 1/{N} OFFSET {i}/{N}\n", + " GROUP BY Date\n", + " ORDER BY Date\n", + " FORMAT TabSeparatedWithNames\n", + " '''.format(i = i, N = N)\n", + " return get_clickhouse_df(q)\n", + "\n", + "tmp_dfs = []\n", + "for i in range(10):\n", + " tmp_dfs.append(load_users_iter(i))" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "df3 = pd.concat(tmp_dfs).groupby('Date').sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
users
Date
2016-10-011482
2016-10-021531
2016-10-033652
2016-10-044220
2016-10-054217
\n", + "
" + ], + "text/plain": [ + " users\n", + "Date \n", + "2016-10-01 1482\n", + "2016-10-02 1531\n", + "2016-10-03 3652\n", + "2016-10-04 4220\n", + "2016-10-05 4217" + ] + }, + "execution_count": 51, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df3.head()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Подзапросы" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Также в ClickHouse есть функции для расчета процентилей `quantile(level)(x)`. Давайте посчитаем распределение числа визитов на посетителя за месяц.\n", + "\n", + "Заодно познакомимся с подзапросами. Для начала расчитаем число сессий на пользователя в сентябре." + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
user_visitsClientID
011502378597495977022
1115052186251004790059
261504627014257703686
311490610856982761788
411503923400410463209
511504179477936790080
621472623288822470147
711500634310192225419
81150524544255174183
911506170539102569045
\n", + "
" + ], + "text/plain": [ + " user_visits ClientID\n", + "0 1 1502378597495977022\n", + "1 1 15052186251004790059\n", + "2 6 1504627014257703686\n", + "3 1 1490610856982761788\n", + "4 1 1503923400410463209\n", + "5 1 1504179477936790080\n", + "6 2 1472623288822470147\n", + "7 1 1500634310192225419\n", + "8 1 150524544255174183\n", + "9 1 1506170539102569045" + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as user_visits,\n", + " ClientID\n", + " FROM visits_all\n", + " WHERE Date >= '2017-09-01' \n", + " AND Date <= '2017-09-31'\n", + " AND ClientID != 0\n", + " GROUP BY ClientID\n", + " LIMIT 10\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
user_visits_p25user_visits_p50user_visits_p75user_visits_p90user_visits_p95user_visits_p99
0111349
\n", + "
" + ], + "text/plain": [ + " user_visits_p25 user_visits_p50 user_visits_p75 user_visits_p90 \\\n", + "0 1 1 1 3 \n", + "\n", + " user_visits_p95 user_visits_p99 \n", + "0 4 9 " + ] + }, + "execution_count": 53, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " quantile(0.25)(user_visits) as user_visits_p25,\n", + " quantile(0.5)(user_visits) as user_visits_p50,\n", + " quantile(0.75)(user_visits) as user_visits_p75,\n", + " quantile(0.9)(user_visits) as user_visits_p90,\n", + " quantile(0.95)(user_visits) as user_visits_p95,\n", + " quantile(0.99)(user_visits) as user_visits_p99\n", + " FROM\n", + " (SELECT\n", + " count() as user_visits,\n", + " ClientID\n", + " FROM visits_all\n", + " WHERE Date >= '2017-09-01' \n", + " AND Date <= '2017-09-31'\n", + " AND ClientID != 0\n", + " GROUP BY ClientID)\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Создадим таблицу с посетителями, которые заходили на сайт с поиска Яндекса." + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "''" + ] + }, + "execution_count": 54, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " CREATE TABLE ya_ids ENGINE = Log AS \n", + " SELECT DISTINCT\n", + " ClientID\n", + " FROM visits_all\n", + " WHERE domain(Referer) LIKE '%yandex.%'\n", + "'''\n", + "\n", + "get_clickhouse_data(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "307110\n", + "\n" + ] + } + ], + "source": [ + "q = 'SELECT count() from ya_ids'\n", + "print(get_clickhouse_data(q))" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
avg_visits_per_user
02.49
\n", + "
" + ], + "text/plain": [ + " avg_visits_per_user\n", + "0 2.49" + ] + }, + "execution_count": 57, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " round(count()/uniq(ClientID), 2) as avg_visits_per_user\n", + " FROM visits_all\n", + " WHERE ClientID IN (SELECT ClientID FROM ya_ids)\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
avg_visits_per_userfrom_yandex
02.49yandex
11.46no yandex
\n", + "
" + ], + "text/plain": [ + " avg_visits_per_user from_yandex\n", + "0 2.49 yandex\n", + "1 1.46 no yandex" + ] + }, + "execution_count": 59, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT \n", + " round(count()/uniq(ClientID), 2) as avg_visits_per_user,\n", + " if(ClientID IN (SELECT ClientID FROM ya_ids), 'yandex', 'no yandex') as from_yandex\n", + " FROM visits_all\n", + " GROUP BY from_yandex\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Полезные функции\n", + "### Функции для работы с датами" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "В ClickHouse есть удобные функции по работе с датой и временем, например, чтобы получить текущие дату и время. \n", + "Также для дат и времени поддержаны операции сложения и вычитания, которые прибавляют/отнимают соответственно дни и секунды." + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
todayyesterdayprevious_week
02017-11-062017-11-052017-10-30
\n", + "
" + ], + "text/plain": [ + " today yesterday previous_week\n", + "0 2017-11-06 2017-11-05 2017-10-30" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " today() as today,\n", + " yesterday() as yesterday,\n", + " today() - 7 as previous_week\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
nowprev_hourprevious_day
02017-11-06 06:39:152017-11-06 05:39:152017-11-05 06:39:15
\n", + "
" + ], + "text/plain": [ + " now prev_hour previous_day\n", + "0 2017-11-06 06:39:15 2017-11-06 05:39:15 2017-11-05 06:39:15" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " now() as now,\n", + " now() - 60*60 as prev_hour,\n", + " now() - 24*60*60 as previous_day\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
yearmonthdayhourminutes
02017116639
\n", + "
" + ], + "text/plain": [ + " year month day hour minutes\n", + "0 2017 11 6 6 39" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " toYear(now()) as year,\n", + " toMonth(now()) as month,\n", + " toDayOfMonth(now()) as day,\n", + " toHour(now()) as hour,\n", + " toMinute(now()) as minutes\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Можем посчитать распределение заходов на сайт по дням недели." + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "data": [ + { + "name": "visits", + "type": "bar", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7 + ], + "y": [ + 209714, + 218548, + 215787, + 211603, + 188631, + 86662, + 91341 + ] + } + ], + "layout": { + "title": "Visits by day of week" + } + }, + "text/html": [ + "
" + ], + "text/vnd.plotly.v1+html": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as visits,\n", + " toDayOfWeek(Date) as day\n", + " FROM visits_all\n", + " GROUP BY day\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "plotly_bar_df(get_clickhouse_df(q).set_index('day'), title = 'Visits by day of week')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Можно сделать ответ еще лучше, заменив id дней недели на их названия." + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "data": [ + { + "name": "visits", + "type": "bar", + "x": [ + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday" + ], + "y": [ + 209714, + 218548, + 215787, + 211603, + 188631, + 86662, + 91341 + ] + } + ], + "layout": { + "title": "Visits by day of week" + } + }, + "text/html": [ + "
" + ], + "text/vnd.plotly.v1+html": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as visits,\n", + " transform(\n", + " toDayOfWeek(Date),\n", + " [1, 2, 3, 4, 5, 6, 7],\n", + " ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],\n", + " 'Error'\n", + " ) as day\n", + " FROM visits_all\n", + " GROUP BY day\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "plotly_bar_df(\n", + " get_clickhouse_df(q).set_index('day'), \n", + " title = 'Visits by day of week', \n", + " index = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Еще одна полезная функция по работе с датами - это приведение к началу периода `toStartOfMonth`, `toStartOfYear`, `toStartOfMinute`, `toStartOfHour` и т.д." + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "data": [ + { + "mode": "lines", + "name": "visits", + "type": "scatter", + "x": [ + "2016-10-01", + "2016-11-01", + "2016-12-01", + "2017-01-01", + "2017-02-01", + "2017-03-01", + "2017-04-01", + "2017-05-01", + "2017-06-01", + "2017-07-01", + "2017-08-01", + "2017-09-01", + "2017-10-01" + ], + "y": [ + 89962, + 92666, + 83801, + 75368, + 79689, + 94048, + 85727, + 81040, + 77939, + 72714, + 72164, + 71702, + 1255 + ] + } + ], + "layout": { + "title": "Visits from Russia" + } + }, + "text/html": [ + "
" + ], + "text/vnd.plotly.v1+html": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as visits,\n", + " toStartOfMonth(Date) as date\n", + " FROM visits_all\n", + " WHERE RegionCountry = 'Russia'\n", + " GROUP BY date\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "plotly_line_df(get_clickhouse_df(q).set_index('date'), title = 'Visits from Russia')" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "data": [ + { + "mode": "lines", + "name": "visits", + "type": "scatter", + "x": [ + "2017-09-01 00:00:00", + "2017-09-01 00:05:00", + "2017-09-01 00:10:00", + "2017-09-01 00:15:00", + "2017-09-01 00:20:00", + "2017-09-01 00:25:00", + "2017-09-01 00:30:00", + "2017-09-01 00:35:00", + "2017-09-01 00:40:00", + "2017-09-01 00:45:00", + "2017-09-01 00:50:00", + "2017-09-01 00:55:00", + "2017-09-01 01:00:00", + "2017-09-01 01:05:00", + "2017-09-01 01:10:00", + "2017-09-01 01:15:00", + "2017-09-01 01:20:00", + "2017-09-01 01:25:00", + "2017-09-01 01:35:00", + "2017-09-01 01:40:00", + "2017-09-01 01:45:00", + "2017-09-01 01:55:00", + "2017-09-01 02:00:00", + "2017-09-01 02:10:00", + "2017-09-01 02:15:00", + "2017-09-01 02:20:00", + "2017-09-01 02:25:00", + "2017-09-01 02:30:00", + "2017-09-01 02:40:00", + "2017-09-01 02:45:00", + "2017-09-01 02:50:00", + "2017-09-01 02:55:00", + "2017-09-01 03:00:00", + "2017-09-01 03:10:00", + "2017-09-01 03:25:00", + "2017-09-01 03:30:00", + "2017-09-01 03:35:00", + "2017-09-01 03:40:00", + "2017-09-01 03:45:00", + "2017-09-01 04:00:00", + "2017-09-01 04:05:00", + "2017-09-01 04:20:00", + "2017-09-01 04:40:00", + "2017-09-01 04:45:00", + "2017-09-01 04:55:00", + "2017-09-01 05:00:00", + "2017-09-01 05:10:00", + "2017-09-01 05:15:00", + "2017-09-01 05:25:00", + "2017-09-01 05:30:00", + "2017-09-01 05:35:00", + "2017-09-01 05:40:00", + "2017-09-01 05:45:00", + "2017-09-01 05:50:00", + "2017-09-01 05:55:00", + "2017-09-01 06:00:00", + "2017-09-01 06:05:00", + "2017-09-01 06:10:00", + "2017-09-01 06:15:00", + "2017-09-01 06:25:00", + "2017-09-01 06:30:00", + "2017-09-01 06:35:00", + "2017-09-01 06:40:00", + "2017-09-01 06:45:00", + "2017-09-01 06:50:00", + "2017-09-01 06:55:00", + "2017-09-01 07:00:00", + "2017-09-01 07:05:00", + "2017-09-01 07:10:00", + "2017-09-01 07:15:00", + "2017-09-01 07:20:00", + "2017-09-01 07:25:00", + "2017-09-01 07:30:00", + "2017-09-01 07:35:00", + "2017-09-01 07:40:00", + "2017-09-01 07:45:00", + "2017-09-01 07:50:00", + "2017-09-01 07:55:00", + "2017-09-01 08:00:00", + "2017-09-01 08:05:00", + "2017-09-01 08:10:00", + "2017-09-01 08:15:00", + "2017-09-01 08:20:00", + "2017-09-01 08:25:00", + "2017-09-01 08:30:00", + "2017-09-01 08:35:00", + "2017-09-01 08:40:00", + "2017-09-01 08:45:00", + "2017-09-01 08:50:00", + "2017-09-01 08:55:00", + "2017-09-01 09:00:00", + "2017-09-01 09:05:00", + "2017-09-01 09:10:00", + "2017-09-01 09:15:00", + "2017-09-01 09:20:00", + "2017-09-01 09:25:00", + "2017-09-01 09:30:00", + "2017-09-01 09:35:00", + "2017-09-01 09:40:00", + "2017-09-01 09:45:00", + "2017-09-01 09:50:00", + "2017-09-01 09:55:00", + "2017-09-01 10:00:00", + "2017-09-01 10:05:00", + "2017-09-01 10:10:00", + "2017-09-01 10:15:00", + "2017-09-01 10:20:00", + "2017-09-01 10:25:00", + "2017-09-01 10:30:00", + "2017-09-01 10:35:00", + "2017-09-01 10:40:00", + "2017-09-01 10:45:00", + "2017-09-01 10:50:00", + "2017-09-01 10:55:00", + "2017-09-01 11:00:00", + "2017-09-01 11:05:00", + "2017-09-01 11:10:00", + "2017-09-01 11:15:00", + "2017-09-01 11:20:00", + "2017-09-01 11:25:00", + "2017-09-01 11:30:00", + "2017-09-01 11:35:00", + "2017-09-01 11:40:00", + "2017-09-01 11:45:00", + "2017-09-01 11:50:00", + "2017-09-01 11:55:00", + "2017-09-01 12:00:00", + "2017-09-01 12:05:00", + "2017-09-01 12:10:00", + "2017-09-01 12:15:00", + "2017-09-01 12:20:00", + "2017-09-01 12:25:00", + "2017-09-01 12:30:00", + "2017-09-01 12:35:00", + "2017-09-01 12:40:00", + "2017-09-01 12:45:00", + "2017-09-01 12:50:00", + "2017-09-01 12:55:00", + "2017-09-01 13:00:00", + "2017-09-01 13:05:00", + "2017-09-01 13:10:00", + "2017-09-01 13:15:00", + "2017-09-01 13:20:00", + "2017-09-01 13:25:00", + "2017-09-01 13:30:00", + "2017-09-01 13:35:00", + "2017-09-01 13:40:00", + "2017-09-01 13:45:00", + "2017-09-01 13:50:00", + "2017-09-01 13:55:00", + "2017-09-01 14:00:00", + "2017-09-01 14:05:00", + "2017-09-01 14:10:00", + "2017-09-01 14:15:00", + "2017-09-01 14:20:00", + "2017-09-01 14:25:00", + "2017-09-01 14:30:00", + "2017-09-01 14:35:00", + "2017-09-01 14:40:00", + "2017-09-01 14:45:00", + "2017-09-01 14:50:00", + "2017-09-01 14:55:00", + "2017-09-01 15:00:00", + "2017-09-01 15:05:00", + "2017-09-01 15:10:00", + "2017-09-01 15:15:00", + "2017-09-01 15:20:00", + "2017-09-01 15:25:00", + "2017-09-01 15:30:00", + "2017-09-01 15:35:00", + "2017-09-01 15:40:00", + "2017-09-01 15:45:00", + "2017-09-01 15:50:00", + "2017-09-01 15:55:00", + "2017-09-01 16:00:00", + "2017-09-01 16:05:00", + "2017-09-01 16:10:00", + "2017-09-01 16:15:00", + "2017-09-01 16:20:00", + "2017-09-01 16:25:00", + "2017-09-01 16:30:00", + "2017-09-01 16:35:00", + "2017-09-01 16:40:00", + "2017-09-01 16:45:00", + "2017-09-01 16:50:00", + "2017-09-01 16:55:00", + "2017-09-01 17:00:00", + "2017-09-01 17:05:00", + "2017-09-01 17:10:00", + "2017-09-01 17:15:00", + "2017-09-01 17:20:00", + "2017-09-01 17:25:00", + "2017-09-01 17:30:00", + "2017-09-01 17:35:00", + "2017-09-01 17:40:00", + "2017-09-01 17:45:00", + "2017-09-01 17:50:00", + "2017-09-01 17:55:00", + "2017-09-01 18:00:00", + "2017-09-01 18:05:00", + "2017-09-01 18:10:00", + "2017-09-01 18:15:00", + "2017-09-01 18:20:00", + "2017-09-01 18:25:00", + "2017-09-01 18:30:00", + "2017-09-01 18:35:00", + "2017-09-01 18:40:00", + "2017-09-01 18:45:00", + "2017-09-01 18:50:00", + "2017-09-01 18:55:00", + "2017-09-01 19:00:00", + "2017-09-01 19:05:00", + "2017-09-01 19:10:00", + "2017-09-01 19:15:00", + "2017-09-01 19:20:00", + "2017-09-01 19:25:00", + "2017-09-01 19:30:00", + "2017-09-01 19:35:00", + "2017-09-01 19:40:00", + "2017-09-01 19:45:00", + "2017-09-01 19:50:00", + "2017-09-01 19:55:00", + "2017-09-01 20:00:00", + "2017-09-01 20:05:00", + "2017-09-01 20:10:00", + "2017-09-01 20:15:00", + "2017-09-01 20:20:00", + "2017-09-01 20:25:00", + "2017-09-01 20:30:00", + "2017-09-01 20:35:00", + "2017-09-01 20:40:00", + "2017-09-01 20:45:00", + "2017-09-01 20:50:00", + "2017-09-01 20:55:00", + "2017-09-01 21:00:00", + "2017-09-01 21:05:00", + "2017-09-01 21:10:00", + "2017-09-01 21:15:00", + "2017-09-01 21:20:00", + "2017-09-01 21:25:00", + "2017-09-01 21:30:00", + "2017-09-01 21:35:00", + "2017-09-01 21:40:00", + "2017-09-01 21:45:00", + "2017-09-01 21:50:00", + "2017-09-01 21:55:00", + "2017-09-01 22:00:00", + "2017-09-01 22:05:00", + "2017-09-01 22:10:00", + "2017-09-01 22:15:00", + "2017-09-01 22:20:00", + "2017-09-01 22:25:00", + "2017-09-01 22:30:00", + "2017-09-01 22:35:00", + "2017-09-01 22:40:00", + "2017-09-01 22:45:00", + "2017-09-01 22:50:00", + "2017-09-01 22:55:00", + "2017-09-01 23:00:00", + "2017-09-01 23:05:00", + "2017-09-01 23:10:00", + "2017-09-01 23:15:00", + "2017-09-01 23:20:00", + "2017-09-01 23:25:00", + "2017-09-01 23:30:00", + "2017-09-01 23:35:00", + "2017-09-01 23:45:00", + "2017-09-01 23:50:00", + "2017-09-01 23:55:00" + ], + "y": [ + 4, + 5, + 7, + 9, + 4, + 1, + 1, + 7, + 4, + 3, + 1, + 1, + 2, + 3, + 1, + 3, + 4, + 3, + 1, + 2, + 1, + 5, + 2, + 3, + 3, + 4, + 2, + 2, + 1, + 2, + 1, + 1, + 1, + 2, + 1, + 2, + 2, + 1, + 2, + 2, + 1, + 2, + 3, + 2, + 1, + 2, + 1, + 3, + 2, + 1, + 4, + 1, + 2, + 4, + 1, + 3, + 5, + 3, + 3, + 3, + 6, + 3, + 4, + 1, + 3, + 6, + 5, + 3, + 5, + 5, + 2, + 3, + 6, + 3, + 5, + 5, + 5, + 3, + 4, + 5, + 6, + 4, + 5, + 10, + 8, + 8, + 8, + 3, + 11, + 8, + 12, + 9, + 11, + 10, + 5, + 13, + 8, + 13, + 8, + 11, + 10, + 14, + 14, + 17, + 16, + 20, + 18, + 23, + 16, + 14, + 20, + 14, + 18, + 11, + 23, + 16, + 8, + 17, + 17, + 11, + 22, + 25, + 22, + 14, + 22, + 30, + 22, + 12, + 16, + 19, + 19, + 17, + 21, + 12, + 19, + 13, + 16, + 15, + 21, + 22, + 12, + 18, + 18, + 14, + 19, + 25, + 14, + 16, + 13, + 16, + 15, + 11, + 15, + 16, + 24, + 17, + 16, + 24, + 17, + 15, + 15, + 15, + 19, + 8, + 20, + 13, + 12, + 15, + 10, + 16, + 20, + 15, + 20, + 17, + 14, + 11, + 16, + 15, + 14, + 11, + 10, + 10, + 13, + 9, + 14, + 15, + 12, + 12, + 14, + 8, + 9, + 14, + 13, + 11, + 13, + 10, + 8, + 9, + 11, + 11, + 4, + 10, + 10, + 5, + 7, + 6, + 9, + 9, + 7, + 8, + 5, + 7, + 6, + 4, + 6, + 5, + 7, + 9, + 3, + 7, + 5, + 7, + 1, + 6, + 5, + 4, + 7, + 3, + 4, + 6, + 8, + 6, + 2, + 3, + 6, + 6, + 6, + 6, + 6, + 3, + 2, + 8, + 7, + 6, + 2, + 3, + 3, + 9, + 7, + 7, + 6, + 5, + 8, + 5, + 2, + 1, + 9, + 1, + 5, + 7, + 3, + 8, + 1, + 3, + 3, + 5, + 1, + 3, + 5 + ] + } + ], + "layout": { + "title": "Visits from Russia" + } + }, + "text/html": [ + "
" + ], + "text/vnd.plotly.v1+html": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as visits,\n", + " toStartOfFiveMinute(DateTime) as date\n", + " FROM visits_all\n", + " WHERE RegionCountry = 'Russia'\n", + " AND Date = '2017-09-01'\n", + " GROUP BY date\n", + " ORDER BY date\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "plotly_line_df(get_clickhouse_df(q).set_index('date'), title = 'Visits from Russia')" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "data": [ + { + "mode": "lines", + "name": "today_visits", + "type": "scatter", + "x": [ + "2017-08-25 00:00:00", + "2017-08-25 00:05:00", + "2017-08-25 00:10:00", + "2017-08-25 00:15:00", + "2017-08-25 00:20:00", + "2017-08-25 00:30:00", + "2017-08-25 00:35:00", + "2017-08-25 00:40:00", + "2017-08-25 00:45:00", + "2017-08-25 00:50:00", + "2017-08-25 00:55:00", + "2017-08-25 01:00:00", + "2017-08-25 01:05:00", + "2017-08-25 01:20:00", + "2017-08-25 01:25:00", + "2017-08-25 01:35:00", + "2017-08-25 01:45:00", + "2017-08-25 01:55:00", + "2017-08-25 02:00:00", + "2017-08-25 02:05:00", + "2017-08-25 02:10:00", + "2017-08-25 02:15:00", + "2017-08-25 02:20:00", + "2017-08-25 02:25:00", + "2017-08-25 02:45:00", + "2017-08-25 02:50:00", + "2017-08-25 03:10:00", + "2017-08-25 03:15:00", + "2017-08-25 03:20:00", + "2017-08-25 03:30:00", + "2017-08-25 03:40:00", + "2017-08-25 03:45:00", + "2017-08-25 03:55:00", + "2017-08-25 04:00:00", + "2017-08-25 04:05:00", + "2017-08-25 04:15:00", + "2017-08-25 04:25:00", + "2017-08-25 04:30:00", + "2017-08-25 04:35:00", + "2017-08-25 04:40:00", + "2017-08-25 04:50:00", + "2017-08-25 04:55:00", + "2017-08-25 05:05:00", + "2017-08-25 05:10:00", + "2017-08-25 05:15:00", + "2017-08-25 05:25:00", + "2017-08-25 05:30:00", + "2017-08-25 05:35:00", + "2017-08-25 05:40:00", + "2017-08-25 05:45:00", + "2017-08-25 05:50:00", + "2017-08-25 05:55:00", + "2017-08-25 06:05:00", + "2017-08-25 06:10:00", + "2017-08-25 06:15:00", + "2017-08-25 06:20:00", + "2017-08-25 06:25:00", + "2017-08-25 06:30:00", + "2017-08-25 06:35:00", + "2017-08-25 06:40:00", + "2017-08-25 06:45:00", + "2017-08-25 06:50:00", + "2017-08-25 06:55:00", + "2017-08-25 07:00:00", + "2017-08-25 07:05:00", + "2017-08-25 07:10:00", + "2017-08-25 07:15:00", + "2017-08-25 07:20:00", + "2017-08-25 07:25:00", + "2017-08-25 07:30:00", + "2017-08-25 07:35:00", + "2017-08-25 07:40:00", + "2017-08-25 07:45:00", + "2017-08-25 07:50:00", + "2017-08-25 07:55:00", + "2017-08-25 08:00:00", + "2017-08-25 08:05:00", + "2017-08-25 08:10:00", + "2017-08-25 08:15:00", + "2017-08-25 08:20:00", + "2017-08-25 08:25:00", + "2017-08-25 08:30:00", + "2017-08-25 08:35:00", + "2017-08-25 08:40:00", + "2017-08-25 08:45:00", + "2017-08-25 08:50:00", + "2017-08-25 08:55:00", + "2017-08-25 09:00:00", + "2017-08-25 09:05:00", + "2017-08-25 09:10:00", + "2017-08-25 09:15:00", + "2017-08-25 09:20:00", + "2017-08-25 09:25:00", + "2017-08-25 09:30:00", + "2017-08-25 09:35:00", + "2017-08-25 09:40:00", + "2017-08-25 09:45:00", + "2017-08-25 09:50:00", + "2017-08-25 09:55:00", + "2017-08-25 10:00:00", + "2017-08-25 10:05:00", + "2017-08-25 10:10:00", + "2017-08-25 10:15:00", + "2017-08-25 10:20:00", + "2017-08-25 10:25:00", + "2017-08-25 10:30:00", + "2017-08-25 10:35:00", + "2017-08-25 10:40:00", + "2017-08-25 10:45:00", + "2017-08-25 10:50:00", + "2017-08-25 10:55:00", + "2017-08-25 11:00:00", + "2017-08-25 11:05:00", + "2017-08-25 11:10:00", + "2017-08-25 11:15:00", + "2017-08-25 11:20:00", + "2017-08-25 11:25:00", + "2017-08-25 11:30:00", + "2017-08-25 11:35:00", + "2017-08-25 11:40:00", + "2017-08-25 11:45:00", + "2017-08-25 11:50:00", + "2017-08-25 11:55:00", + "2017-08-25 12:00:00", + "2017-08-25 12:05:00", + "2017-08-25 12:10:00", + "2017-08-25 12:15:00", + "2017-08-25 12:20:00", + "2017-08-25 12:25:00", + "2017-08-25 12:30:00", + "2017-08-25 12:35:00", + "2017-08-25 12:40:00", + "2017-08-25 12:45:00", + "2017-08-25 12:50:00", + "2017-08-25 12:55:00", + "2017-08-25 13:00:00", + "2017-08-25 13:05:00", + "2017-08-25 13:10:00", + "2017-08-25 13:15:00", + "2017-08-25 13:20:00", + "2017-08-25 13:25:00", + "2017-08-25 13:30:00", + "2017-08-25 13:35:00", + "2017-08-25 13:40:00", + "2017-08-25 13:45:00", + "2017-08-25 13:50:00", + "2017-08-25 13:55:00", + "2017-08-25 14:00:00", + "2017-08-25 14:05:00", + "2017-08-25 14:10:00", + "2017-08-25 14:15:00", + "2017-08-25 14:20:00", + "2017-08-25 14:25:00", + "2017-08-25 14:30:00", + "2017-08-25 14:35:00", + "2017-08-25 14:40:00", + "2017-08-25 14:45:00", + "2017-08-25 14:50:00", + "2017-08-25 14:55:00", + "2017-08-25 15:00:00", + "2017-08-25 15:05:00", + "2017-08-25 15:10:00", + "2017-08-25 15:15:00", + "2017-08-25 15:20:00", + "2017-08-25 15:25:00", + "2017-08-25 15:30:00", + "2017-08-25 15:35:00", + "2017-08-25 15:40:00", + "2017-08-25 15:45:00", + "2017-08-25 15:50:00", + "2017-08-25 15:55:00", + "2017-08-25 16:00:00", + "2017-08-25 16:05:00", + "2017-08-25 16:10:00", + "2017-08-25 16:15:00", + "2017-08-25 16:20:00", + "2017-08-25 16:25:00", + "2017-08-25 16:30:00", + "2017-08-25 16:35:00", + "2017-08-25 16:40:00", + "2017-08-25 16:45:00", + "2017-08-25 16:50:00", + "2017-08-25 16:55:00", + "2017-08-25 17:00:00", + "2017-08-25 17:05:00", + "2017-08-25 17:10:00", + "2017-08-25 17:15:00", + "2017-08-25 17:20:00", + "2017-08-25 17:25:00", + "2017-08-25 17:30:00", + "2017-08-25 17:35:00", + "2017-08-25 17:40:00", + "2017-08-25 17:45:00", + "2017-08-25 17:50:00", + "2017-08-25 17:55:00", + "2017-08-25 18:00:00", + "2017-08-25 18:05:00", + "2017-08-25 18:10:00", + "2017-08-25 18:15:00", + "2017-08-25 18:20:00", + "2017-08-25 18:25:00", + "2017-08-25 18:30:00", + "2017-08-25 18:35:00", + "2017-08-25 18:40:00", + "2017-08-25 18:45:00", + "2017-08-25 18:50:00", + "2017-08-25 18:55:00", + "2017-08-25 19:00:00", + "2017-08-25 19:05:00", + "2017-08-25 19:10:00", + "2017-08-25 19:15:00", + "2017-08-25 19:20:00", + "2017-08-25 19:25:00", + "2017-08-25 19:30:00", + "2017-08-25 19:35:00", + "2017-08-25 19:40:00", + "2017-08-25 19:45:00", + "2017-08-25 19:50:00", + "2017-08-25 19:55:00", + "2017-08-25 20:00:00", + "2017-08-25 20:05:00", + "2017-08-25 20:10:00", + "2017-08-25 20:15:00", + "2017-08-25 20:20:00", + "2017-08-25 20:25:00", + "2017-08-25 20:30:00", + "2017-08-25 20:35:00", + "2017-08-25 20:40:00", + "2017-08-25 20:45:00", + "2017-08-25 20:50:00", + "2017-08-25 20:55:00", + "2017-08-25 21:00:00", + "2017-08-25 21:05:00", + "2017-08-25 21:10:00", + "2017-08-25 21:15:00", + "2017-08-25 21:20:00", + "2017-08-25 21:25:00", + "2017-08-25 21:30:00", + "2017-08-25 21:35:00", + "2017-08-25 21:40:00", + "2017-08-25 21:45:00", + "2017-08-25 21:50:00", + "2017-08-25 21:55:00", + "2017-08-25 22:00:00", + "2017-08-25 22:05:00", + "2017-08-25 22:10:00", + "2017-08-25 22:15:00", + "2017-08-25 22:20:00", + "2017-08-25 22:25:00", + "2017-08-25 22:30:00", + "2017-08-25 22:35:00", + "2017-08-25 22:40:00", + "2017-08-25 22:45:00", + "2017-08-25 22:50:00", + "2017-08-25 22:55:00", + "2017-08-25 23:00:00", + "2017-08-25 23:05:00", + "2017-08-25 23:10:00", + "2017-08-25 23:15:00", + "2017-08-25 23:20:00", + "2017-08-25 23:25:00", + "2017-08-25 23:30:00", + "2017-08-25 23:35:00", + "2017-08-25 23:40:00", + "2017-08-25 23:45:00", + "2017-08-25 23:50:00", + "2017-08-25 23:55:00", + "2017-08-31 00:00:00", + "2017-08-31 00:05:00", + "2017-08-31 00:10:00", + "2017-08-31 00:15:00", + "2017-08-31 00:25:00", + "2017-08-31 00:30:00", + "2017-08-31 00:35:00", + "2017-08-31 00:40:00", + "2017-08-31 00:45:00", + "2017-08-31 00:50:00", + "2017-08-31 01:00:00", + "2017-08-31 01:05:00", + "2017-08-31 01:10:00", + "2017-08-31 01:15:00", + "2017-08-31 01:20:00", + "2017-08-31 01:25:00", + "2017-08-31 01:35:00", + "2017-08-31 01:40:00", + "2017-08-31 01:45:00", + "2017-08-31 01:50:00", + "2017-08-31 01:55:00", + "2017-08-31 02:00:00", + "2017-08-31 02:05:00", + "2017-08-31 02:10:00", + "2017-08-31 02:15:00", + "2017-08-31 02:25:00", + "2017-08-31 02:35:00", + "2017-08-31 02:40:00", + "2017-08-31 02:45:00", + "2017-08-31 02:50:00", + "2017-08-31 02:55:00", + "2017-08-31 03:05:00", + "2017-08-31 03:15:00", + "2017-08-31 03:20:00", + "2017-08-31 03:25:00", + "2017-08-31 03:35:00", + "2017-08-31 03:45:00", + "2017-08-31 03:50:00", + "2017-08-31 03:55:00", + "2017-08-31 04:00:00", + "2017-08-31 04:05:00", + "2017-08-31 04:10:00", + "2017-08-31 04:15:00", + "2017-08-31 04:20:00", + "2017-08-31 04:25:00", + "2017-08-31 04:30:00", + "2017-08-31 04:35:00", + "2017-08-31 04:40:00", + "2017-08-31 04:50:00", + "2017-08-31 05:00:00", + "2017-08-31 05:05:00", + "2017-08-31 05:10:00", + "2017-08-31 05:15:00", + "2017-08-31 05:20:00", + "2017-08-31 05:25:00", + "2017-08-31 05:30:00", + "2017-08-31 05:35:00", + "2017-08-31 05:40:00", + "2017-08-31 05:45:00", + "2017-08-31 05:50:00", + "2017-08-31 05:55:00", + "2017-08-31 06:00:00", + "2017-08-31 06:05:00", + "2017-08-31 06:15:00", + "2017-08-31 06:20:00", + "2017-08-31 06:25:00", + "2017-08-31 06:30:00", + "2017-08-31 06:35:00", + "2017-08-31 06:40:00", + "2017-08-31 06:45:00", + "2017-08-31 06:50:00", + "2017-08-31 06:55:00", + "2017-08-31 07:00:00", + "2017-08-31 07:05:00", + "2017-08-31 07:10:00", + "2017-08-31 07:15:00", + "2017-08-31 07:20:00", + "2017-08-31 07:25:00", + "2017-08-31 07:30:00", + "2017-08-31 07:35:00", + "2017-08-31 07:40:00", + "2017-08-31 07:45:00", + "2017-08-31 07:50:00", + "2017-08-31 07:55:00", + "2017-08-31 08:00:00", + "2017-08-31 08:05:00", + "2017-08-31 08:10:00", + "2017-08-31 08:15:00", + "2017-08-31 08:20:00", + "2017-08-31 08:25:00", + "2017-08-31 08:30:00", + "2017-08-31 08:35:00", + "2017-08-31 08:40:00", + "2017-08-31 08:45:00", + "2017-08-31 08:50:00", + "2017-08-31 08:55:00", + "2017-08-31 09:00:00", + "2017-08-31 09:05:00", + "2017-08-31 09:10:00", + "2017-08-31 09:15:00", + "2017-08-31 09:20:00", + "2017-08-31 09:25:00", + "2017-08-31 09:30:00", + "2017-08-31 09:35:00", + "2017-08-31 09:40:00", + "2017-08-31 09:45:00", + "2017-08-31 09:50:00", + "2017-08-31 09:55:00", + "2017-08-31 10:00:00", + "2017-08-31 10:05:00", + "2017-08-31 10:10:00", + "2017-08-31 10:15:00", + "2017-08-31 10:20:00", + "2017-08-31 10:25:00", + "2017-08-31 10:30:00", + "2017-08-31 10:35:00", + "2017-08-31 10:40:00", + "2017-08-31 10:45:00", + "2017-08-31 10:50:00", + "2017-08-31 10:55:00", + "2017-08-31 11:00:00", + "2017-08-31 11:05:00", + "2017-08-31 11:10:00", + "2017-08-31 11:15:00", + "2017-08-31 11:20:00", + "2017-08-31 11:25:00", + "2017-08-31 11:30:00", + "2017-08-31 11:35:00", + "2017-08-31 11:40:00", + "2017-08-31 11:45:00", + "2017-08-31 11:50:00", + "2017-08-31 11:55:00", + "2017-08-31 12:00:00", + "2017-08-31 12:05:00", + "2017-08-31 12:10:00", + "2017-08-31 12:15:00", + "2017-08-31 12:20:00", + "2017-08-31 12:25:00", + "2017-08-31 12:30:00", + "2017-08-31 12:35:00", + "2017-08-31 12:40:00", + "2017-08-31 12:45:00", + "2017-08-31 12:50:00", + "2017-08-31 12:55:00", + "2017-08-31 13:00:00", + "2017-08-31 13:05:00", + "2017-08-31 13:10:00", + "2017-08-31 13:15:00", + "2017-08-31 13:20:00", + "2017-08-31 13:25:00", + "2017-08-31 13:30:00", + "2017-08-31 13:35:00", + "2017-08-31 13:40:00", + "2017-08-31 13:45:00", + "2017-08-31 13:50:00", + "2017-08-31 13:55:00", + "2017-08-31 14:00:00", + "2017-08-31 14:05:00", + "2017-08-31 14:10:00", + "2017-08-31 14:15:00", + "2017-08-31 14:20:00", + "2017-08-31 14:25:00", + "2017-08-31 14:30:00", + "2017-08-31 14:35:00", + "2017-08-31 14:40:00", + "2017-08-31 14:45:00", + "2017-08-31 14:50:00", + "2017-08-31 14:55:00", + "2017-08-31 15:00:00", + "2017-08-31 15:05:00", + "2017-08-31 15:10:00", + "2017-08-31 15:15:00", + "2017-08-31 15:20:00", + "2017-08-31 15:25:00", + "2017-08-31 15:30:00", + "2017-08-31 15:35:00", + "2017-08-31 15:40:00", + "2017-08-31 15:45:00", + "2017-08-31 15:50:00", + "2017-08-31 15:55:00", + "2017-08-31 16:00:00", + "2017-08-31 16:05:00", + "2017-08-31 16:10:00", + "2017-08-31 16:15:00", + "2017-08-31 16:20:00", + "2017-08-31 16:25:00", + "2017-08-31 16:30:00", + "2017-08-31 16:35:00", + "2017-08-31 16:40:00", + "2017-08-31 16:45:00", + "2017-08-31 16:50:00", + "2017-08-31 16:55:00", + "2017-08-31 17:00:00", + "2017-08-31 17:05:00", + "2017-08-31 17:10:00", + "2017-08-31 17:15:00", + "2017-08-31 17:20:00", + "2017-08-31 17:25:00", + "2017-08-31 17:30:00", + "2017-08-31 17:35:00", + "2017-08-31 17:40:00", + "2017-08-31 17:45:00", + "2017-08-31 17:50:00", + "2017-08-31 17:55:00", + "2017-08-31 18:00:00", + "2017-08-31 18:05:00", + "2017-08-31 18:10:00", + "2017-08-31 18:15:00", + "2017-08-31 18:20:00", + "2017-08-31 18:25:00", + "2017-08-31 18:30:00", + "2017-08-31 18:35:00", + "2017-08-31 18:40:00", + "2017-08-31 18:45:00", + "2017-08-31 18:50:00", + "2017-08-31 18:55:00", + "2017-08-31 19:00:00", + "2017-08-31 19:05:00", + "2017-08-31 19:10:00", + "2017-08-31 19:15:00", + "2017-08-31 19:20:00", + "2017-08-31 19:25:00", + "2017-08-31 19:30:00", + "2017-08-31 19:35:00", + "2017-08-31 19:40:00", + "2017-08-31 19:45:00", + "2017-08-31 19:50:00", + "2017-08-31 19:55:00", + "2017-08-31 20:00:00", + "2017-08-31 20:05:00", + "2017-08-31 20:10:00", + "2017-08-31 20:15:00", + "2017-08-31 20:20:00", + "2017-08-31 20:25:00", + "2017-08-31 20:30:00", + "2017-08-31 20:35:00", + "2017-08-31 20:40:00", + "2017-08-31 20:45:00", + "2017-08-31 20:50:00", + "2017-08-31 20:55:00", + "2017-08-31 21:00:00", + "2017-08-31 21:05:00", + "2017-08-31 21:10:00", + "2017-08-31 21:15:00", + "2017-08-31 21:20:00", + "2017-08-31 21:25:00", + "2017-08-31 21:30:00", + "2017-08-31 21:35:00", + "2017-08-31 21:40:00", + "2017-08-31 21:45:00", + "2017-08-31 21:50:00", + "2017-08-31 21:55:00", + "2017-08-31 22:00:00", + "2017-08-31 22:05:00", + "2017-08-31 22:10:00", + "2017-08-31 22:15:00", + "2017-08-31 22:20:00", + "2017-08-31 22:25:00", + "2017-08-31 22:30:00", + "2017-08-31 22:35:00", + "2017-08-31 22:40:00", + "2017-08-31 22:45:00", + "2017-08-31 22:50:00", + "2017-08-31 22:55:00", + "2017-08-31 23:00:00", + "2017-08-31 23:05:00", + "2017-08-31 23:10:00", + "2017-08-31 23:15:00", + "2017-08-31 23:20:00", + "2017-08-31 23:25:00", + "2017-08-31 23:30:00", + "2017-08-31 23:35:00", + "2017-08-31 23:40:00", + "2017-08-31 23:45:00", + "2017-08-31 23:50:00", + "2017-08-31 23:55:00", + "2017-09-01 00:00:00", + "2017-09-01 00:05:00", + "2017-09-01 00:10:00", + "2017-09-01 00:15:00", + "2017-09-01 00:20:00", + "2017-09-01 00:25:00", + "2017-09-01 00:30:00", + "2017-09-01 00:35:00", + "2017-09-01 00:40:00", + "2017-09-01 00:45:00", + "2017-09-01 00:50:00", + "2017-09-01 00:55:00", + "2017-09-01 01:00:00", + "2017-09-01 01:05:00", + "2017-09-01 01:10:00", + "2017-09-01 01:15:00", + "2017-09-01 01:20:00", + "2017-09-01 01:25:00", + "2017-09-01 01:35:00", + "2017-09-01 01:40:00", + "2017-09-01 01:45:00", + "2017-09-01 01:55:00", + "2017-09-01 02:00:00", + "2017-09-01 02:10:00", + "2017-09-01 02:15:00", + "2017-09-01 02:20:00", + "2017-09-01 02:25:00", + "2017-09-01 02:30:00", + "2017-09-01 02:40:00", + "2017-09-01 02:45:00", + "2017-09-01 02:50:00", + "2017-09-01 02:55:00", + "2017-09-01 03:00:00", + "2017-09-01 03:10:00", + "2017-09-01 03:25:00", + "2017-09-01 03:30:00", + "2017-09-01 03:35:00", + "2017-09-01 03:40:00", + "2017-09-01 03:45:00", + "2017-09-01 04:00:00", + "2017-09-01 04:05:00", + "2017-09-01 04:20:00", + "2017-09-01 04:40:00", + "2017-09-01 04:45:00", + "2017-09-01 04:55:00", + "2017-09-01 05:00:00", + "2017-09-01 05:10:00", + "2017-09-01 05:15:00", + "2017-09-01 05:25:00", + "2017-09-01 05:30:00", + "2017-09-01 05:35:00", + "2017-09-01 05:40:00", + "2017-09-01 05:45:00", + "2017-09-01 05:50:00", + "2017-09-01 05:55:00", + "2017-09-01 06:00:00", + "2017-09-01 06:05:00", + "2017-09-01 06:10:00", + "2017-09-01 06:15:00", + "2017-09-01 06:25:00", + "2017-09-01 06:30:00", + "2017-09-01 06:35:00", + "2017-09-01 06:40:00", + "2017-09-01 06:45:00", + "2017-09-01 06:50:00", + "2017-09-01 06:55:00", + "2017-09-01 07:00:00", + "2017-09-01 07:05:00", + "2017-09-01 07:10:00", + "2017-09-01 07:15:00", + "2017-09-01 07:20:00", + "2017-09-01 07:25:00", + "2017-09-01 07:30:00", + "2017-09-01 07:35:00", + "2017-09-01 07:40:00", + "2017-09-01 07:45:00", + "2017-09-01 07:50:00", + "2017-09-01 07:55:00", + "2017-09-01 08:00:00", + "2017-09-01 08:05:00", + "2017-09-01 08:10:00", + "2017-09-01 08:15:00", + "2017-09-01 08:20:00", + "2017-09-01 08:25:00", + "2017-09-01 08:30:00", + "2017-09-01 08:35:00", + "2017-09-01 08:40:00", + "2017-09-01 08:45:00", + "2017-09-01 08:50:00", + "2017-09-01 08:55:00", + "2017-09-01 09:00:00", + "2017-09-01 09:05:00", + "2017-09-01 09:10:00", + "2017-09-01 09:15:00", + "2017-09-01 09:20:00", + "2017-09-01 09:25:00", + "2017-09-01 09:30:00", + "2017-09-01 09:35:00", + "2017-09-01 09:40:00", + "2017-09-01 09:45:00", + "2017-09-01 09:50:00", + "2017-09-01 09:55:00", + "2017-09-01 10:00:00", + "2017-09-01 10:05:00", + "2017-09-01 10:10:00", + "2017-09-01 10:15:00", + "2017-09-01 10:20:00", + "2017-09-01 10:25:00", + "2017-09-01 10:30:00", + "2017-09-01 10:35:00", + "2017-09-01 10:40:00", + "2017-09-01 10:45:00", + "2017-09-01 10:50:00", + "2017-09-01 10:55:00", + "2017-09-01 11:00:00", + "2017-09-01 11:05:00", + "2017-09-01 11:10:00", + "2017-09-01 11:15:00", + "2017-09-01 11:20:00", + "2017-09-01 11:25:00", + "2017-09-01 11:30:00", + "2017-09-01 11:35:00", + "2017-09-01 11:40:00", + "2017-09-01 11:45:00", + "2017-09-01 11:50:00", + "2017-09-01 11:55:00", + "2017-09-01 12:00:00", + "2017-09-01 12:05:00", + "2017-09-01 12:10:00", + "2017-09-01 12:15:00", + "2017-09-01 12:20:00", + "2017-09-01 12:25:00", + "2017-09-01 12:30:00", + "2017-09-01 12:35:00", + "2017-09-01 12:40:00", + "2017-09-01 12:45:00", + "2017-09-01 12:50:00", + "2017-09-01 12:55:00", + "2017-09-01 13:00:00", + "2017-09-01 13:05:00", + "2017-09-01 13:10:00", + "2017-09-01 13:15:00", + "2017-09-01 13:20:00", + "2017-09-01 13:25:00", + "2017-09-01 13:30:00", + "2017-09-01 13:35:00", + "2017-09-01 13:40:00", + "2017-09-01 13:45:00", + "2017-09-01 13:50:00", + "2017-09-01 13:55:00", + "2017-09-01 14:00:00", + "2017-09-01 14:05:00", + "2017-09-01 14:10:00", + "2017-09-01 14:15:00", + "2017-09-01 14:20:00", + "2017-09-01 14:25:00", + "2017-09-01 14:30:00", + "2017-09-01 14:35:00", + "2017-09-01 14:40:00", + "2017-09-01 14:45:00", + "2017-09-01 14:50:00", + "2017-09-01 14:55:00", + "2017-09-01 15:00:00", + "2017-09-01 15:05:00", + "2017-09-01 15:10:00", + "2017-09-01 15:15:00", + "2017-09-01 15:20:00", + "2017-09-01 15:25:00", + "2017-09-01 15:30:00", + "2017-09-01 15:35:00", + "2017-09-01 15:40:00", + "2017-09-01 15:45:00", + "2017-09-01 15:50:00", + "2017-09-01 15:55:00", + "2017-09-01 16:00:00", + "2017-09-01 16:05:00", + "2017-09-01 16:10:00", + "2017-09-01 16:15:00", + "2017-09-01 16:20:00", + "2017-09-01 16:25:00", + "2017-09-01 16:30:00", + "2017-09-01 16:35:00", + "2017-09-01 16:40:00", + "2017-09-01 16:45:00", + "2017-09-01 16:50:00", + "2017-09-01 16:55:00", + "2017-09-01 17:00:00", + "2017-09-01 17:05:00", + "2017-09-01 17:10:00", + "2017-09-01 17:15:00", + "2017-09-01 17:20:00", + "2017-09-01 17:25:00", + "2017-09-01 17:30:00", + "2017-09-01 17:35:00", + "2017-09-01 17:40:00", + "2017-09-01 17:45:00", + "2017-09-01 17:50:00", + "2017-09-01 17:55:00", + "2017-09-01 18:00:00", + "2017-09-01 18:05:00", + "2017-09-01 18:10:00", + "2017-09-01 18:15:00", + "2017-09-01 18:20:00", + "2017-09-01 18:25:00", + "2017-09-01 18:30:00", + "2017-09-01 18:35:00", + "2017-09-01 18:40:00", + "2017-09-01 18:45:00", + "2017-09-01 18:50:00", + "2017-09-01 18:55:00", + "2017-09-01 19:00:00", + "2017-09-01 19:05:00", + "2017-09-01 19:10:00", + "2017-09-01 19:15:00", + "2017-09-01 19:20:00", + "2017-09-01 19:25:00", + "2017-09-01 19:30:00", + "2017-09-01 19:35:00", + "2017-09-01 19:40:00", + "2017-09-01 19:45:00", + "2017-09-01 19:50:00", + "2017-09-01 19:55:00", + "2017-09-01 20:00:00", + "2017-09-01 20:05:00", + "2017-09-01 20:10:00", + "2017-09-01 20:15:00", + "2017-09-01 20:20:00", + "2017-09-01 20:25:00", + "2017-09-01 20:30:00", + "2017-09-01 20:35:00", + "2017-09-01 20:40:00", + "2017-09-01 20:45:00", + "2017-09-01 20:50:00", + "2017-09-01 20:55:00", + "2017-09-01 21:00:00", + "2017-09-01 21:05:00", + "2017-09-01 21:10:00", + "2017-09-01 21:15:00", + "2017-09-01 21:20:00", + "2017-09-01 21:25:00", + "2017-09-01 21:30:00", + "2017-09-01 21:35:00", + "2017-09-01 21:40:00", + "2017-09-01 21:45:00", + "2017-09-01 21:50:00", + "2017-09-01 21:55:00", + "2017-09-01 22:00:00", + "2017-09-01 22:05:00", + "2017-09-01 22:10:00", + "2017-09-01 22:15:00", + "2017-09-01 22:20:00", + "2017-09-01 22:25:00", + "2017-09-01 22:30:00", + "2017-09-01 22:35:00", + "2017-09-01 22:40:00", + "2017-09-01 22:45:00", + "2017-09-01 22:50:00", + "2017-09-01 22:55:00", + "2017-09-01 23:00:00", + "2017-09-01 23:05:00", + "2017-09-01 23:10:00", + "2017-09-01 23:15:00", + "2017-09-01 23:20:00", + "2017-09-01 23:25:00", + "2017-09-01 23:30:00", + "2017-09-01 23:35:00", + "2017-09-01 23:45:00", + "2017-09-01 23:50:00", + "2017-09-01 23:55:00" + ], + "y": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4, + 5, + 7, + 9, + 4, + 1, + 1, + 7, + 4, + 3, + 1, + 1, + 2, + 3, + 1, + 3, + 4, + 3, + 1, + 2, + 1, + 5, + 2, + 3, + 3, + 4, + 2, + 2, + 1, + 2, + 1, + 1, + 1, + 2, + 1, + 2, + 2, + 1, + 2, + 2, + 1, + 2, + 3, + 2, + 1, + 2, + 1, + 3, + 2, + 1, + 4, + 1, + 2, + 4, + 1, + 3, + 5, + 3, + 3, + 3, + 6, + 3, + 4, + 1, + 3, + 6, + 5, + 3, + 5, + 5, + 2, + 3, + 6, + 3, + 5, + 5, + 5, + 3, + 4, + 5, + 6, + 4, + 5, + 10, + 8, + 8, + 8, + 3, + 11, + 8, + 12, + 9, + 11, + 10, + 5, + 13, + 8, + 13, + 8, + 11, + 10, + 14, + 14, + 17, + 16, + 20, + 18, + 23, + 16, + 14, + 20, + 14, + 18, + 11, + 23, + 16, + 8, + 17, + 17, + 11, + 22, + 25, + 22, + 14, + 22, + 30, + 22, + 12, + 16, + 19, + 19, + 17, + 21, + 12, + 19, + 13, + 16, + 15, + 21, + 22, + 12, + 18, + 18, + 14, + 19, + 25, + 14, + 16, + 13, + 16, + 15, + 11, + 15, + 16, + 24, + 17, + 16, + 24, + 17, + 15, + 15, + 15, + 19, + 8, + 20, + 13, + 12, + 15, + 10, + 16, + 20, + 15, + 20, + 17, + 14, + 11, + 16, + 15, + 14, + 11, + 10, + 10, + 13, + 9, + 14, + 15, + 12, + 12, + 14, + 8, + 9, + 14, + 13, + 11, + 13, + 10, + 8, + 9, + 11, + 11, + 4, + 10, + 10, + 5, + 7, + 6, + 9, + 9, + 7, + 8, + 5, + 7, + 6, + 4, + 6, + 5, + 7, + 9, + 3, + 7, + 5, + 7, + 1, + 6, + 5, + 4, + 7, + 3, + 4, + 6, + 8, + 6, + 2, + 3, + 6, + 6, + 6, + 6, + 6, + 3, + 2, + 8, + 7, + 6, + 2, + 3, + 3, + 9, + 7, + 7, + 6, + 5, + 8, + 5, + 2, + 1, + 9, + 1, + 5, + 7, + 3, + 8, + 1, + 3, + 3, + 5, + 1, + 3, + 5 + ] + }, + { + "mode": "lines", + "name": "yesterday_visits", + "type": "scatter", + "x": [ + "2017-08-25 00:00:00", + "2017-08-25 00:05:00", + "2017-08-25 00:10:00", + "2017-08-25 00:15:00", + "2017-08-25 00:20:00", + "2017-08-25 00:30:00", + "2017-08-25 00:35:00", + "2017-08-25 00:40:00", + "2017-08-25 00:45:00", + "2017-08-25 00:50:00", + "2017-08-25 00:55:00", + "2017-08-25 01:00:00", + "2017-08-25 01:05:00", + "2017-08-25 01:20:00", + "2017-08-25 01:25:00", + "2017-08-25 01:35:00", + "2017-08-25 01:45:00", + "2017-08-25 01:55:00", + "2017-08-25 02:00:00", + "2017-08-25 02:05:00", + "2017-08-25 02:10:00", + "2017-08-25 02:15:00", + "2017-08-25 02:20:00", + "2017-08-25 02:25:00", + "2017-08-25 02:45:00", + "2017-08-25 02:50:00", + "2017-08-25 03:10:00", + "2017-08-25 03:15:00", + "2017-08-25 03:20:00", + "2017-08-25 03:30:00", + "2017-08-25 03:40:00", + "2017-08-25 03:45:00", + "2017-08-25 03:55:00", + "2017-08-25 04:00:00", + "2017-08-25 04:05:00", + "2017-08-25 04:15:00", + "2017-08-25 04:25:00", + "2017-08-25 04:30:00", + "2017-08-25 04:35:00", + "2017-08-25 04:40:00", + "2017-08-25 04:50:00", + "2017-08-25 04:55:00", + "2017-08-25 05:05:00", + "2017-08-25 05:10:00", + "2017-08-25 05:15:00", + "2017-08-25 05:25:00", + "2017-08-25 05:30:00", + "2017-08-25 05:35:00", + "2017-08-25 05:40:00", + "2017-08-25 05:45:00", + "2017-08-25 05:50:00", + "2017-08-25 05:55:00", + "2017-08-25 06:05:00", + "2017-08-25 06:10:00", + "2017-08-25 06:15:00", + "2017-08-25 06:20:00", + "2017-08-25 06:25:00", + "2017-08-25 06:30:00", + "2017-08-25 06:35:00", + "2017-08-25 06:40:00", + "2017-08-25 06:45:00", + "2017-08-25 06:50:00", + "2017-08-25 06:55:00", + "2017-08-25 07:00:00", + "2017-08-25 07:05:00", + "2017-08-25 07:10:00", + "2017-08-25 07:15:00", + "2017-08-25 07:20:00", + "2017-08-25 07:25:00", + "2017-08-25 07:30:00", + "2017-08-25 07:35:00", + "2017-08-25 07:40:00", + "2017-08-25 07:45:00", + "2017-08-25 07:50:00", + "2017-08-25 07:55:00", + "2017-08-25 08:00:00", + "2017-08-25 08:05:00", + "2017-08-25 08:10:00", + "2017-08-25 08:15:00", + "2017-08-25 08:20:00", + "2017-08-25 08:25:00", + "2017-08-25 08:30:00", + "2017-08-25 08:35:00", + "2017-08-25 08:40:00", + "2017-08-25 08:45:00", + "2017-08-25 08:50:00", + "2017-08-25 08:55:00", + "2017-08-25 09:00:00", + "2017-08-25 09:05:00", + "2017-08-25 09:10:00", + "2017-08-25 09:15:00", + "2017-08-25 09:20:00", + "2017-08-25 09:25:00", + "2017-08-25 09:30:00", + "2017-08-25 09:35:00", + "2017-08-25 09:40:00", + "2017-08-25 09:45:00", + "2017-08-25 09:50:00", + "2017-08-25 09:55:00", + "2017-08-25 10:00:00", + "2017-08-25 10:05:00", + "2017-08-25 10:10:00", + "2017-08-25 10:15:00", + "2017-08-25 10:20:00", + "2017-08-25 10:25:00", + "2017-08-25 10:30:00", + "2017-08-25 10:35:00", + "2017-08-25 10:40:00", + "2017-08-25 10:45:00", + "2017-08-25 10:50:00", + "2017-08-25 10:55:00", + "2017-08-25 11:00:00", + "2017-08-25 11:05:00", + "2017-08-25 11:10:00", + "2017-08-25 11:15:00", + "2017-08-25 11:20:00", + "2017-08-25 11:25:00", + "2017-08-25 11:30:00", + "2017-08-25 11:35:00", + "2017-08-25 11:40:00", + "2017-08-25 11:45:00", + "2017-08-25 11:50:00", + "2017-08-25 11:55:00", + "2017-08-25 12:00:00", + "2017-08-25 12:05:00", + "2017-08-25 12:10:00", + "2017-08-25 12:15:00", + "2017-08-25 12:20:00", + "2017-08-25 12:25:00", + "2017-08-25 12:30:00", + "2017-08-25 12:35:00", + "2017-08-25 12:40:00", + "2017-08-25 12:45:00", + "2017-08-25 12:50:00", + "2017-08-25 12:55:00", + "2017-08-25 13:00:00", + "2017-08-25 13:05:00", + "2017-08-25 13:10:00", + "2017-08-25 13:15:00", + "2017-08-25 13:20:00", + "2017-08-25 13:25:00", + "2017-08-25 13:30:00", + "2017-08-25 13:35:00", + "2017-08-25 13:40:00", + "2017-08-25 13:45:00", + "2017-08-25 13:50:00", + "2017-08-25 13:55:00", + "2017-08-25 14:00:00", + "2017-08-25 14:05:00", + "2017-08-25 14:10:00", + "2017-08-25 14:15:00", + "2017-08-25 14:20:00", + "2017-08-25 14:25:00", + "2017-08-25 14:30:00", + "2017-08-25 14:35:00", + "2017-08-25 14:40:00", + "2017-08-25 14:45:00", + "2017-08-25 14:50:00", + "2017-08-25 14:55:00", + "2017-08-25 15:00:00", + "2017-08-25 15:05:00", + "2017-08-25 15:10:00", + "2017-08-25 15:15:00", + "2017-08-25 15:20:00", + "2017-08-25 15:25:00", + "2017-08-25 15:30:00", + "2017-08-25 15:35:00", + "2017-08-25 15:40:00", + "2017-08-25 15:45:00", + "2017-08-25 15:50:00", + "2017-08-25 15:55:00", + "2017-08-25 16:00:00", + "2017-08-25 16:05:00", + "2017-08-25 16:10:00", + "2017-08-25 16:15:00", + "2017-08-25 16:20:00", + "2017-08-25 16:25:00", + "2017-08-25 16:30:00", + "2017-08-25 16:35:00", + "2017-08-25 16:40:00", + "2017-08-25 16:45:00", + "2017-08-25 16:50:00", + "2017-08-25 16:55:00", + "2017-08-25 17:00:00", + "2017-08-25 17:05:00", + "2017-08-25 17:10:00", + "2017-08-25 17:15:00", + "2017-08-25 17:20:00", + "2017-08-25 17:25:00", + "2017-08-25 17:30:00", + "2017-08-25 17:35:00", + "2017-08-25 17:40:00", + "2017-08-25 17:45:00", + "2017-08-25 17:50:00", + "2017-08-25 17:55:00", + "2017-08-25 18:00:00", + "2017-08-25 18:05:00", + "2017-08-25 18:10:00", + "2017-08-25 18:15:00", + "2017-08-25 18:20:00", + "2017-08-25 18:25:00", + "2017-08-25 18:30:00", + "2017-08-25 18:35:00", + "2017-08-25 18:40:00", + "2017-08-25 18:45:00", + "2017-08-25 18:50:00", + "2017-08-25 18:55:00", + "2017-08-25 19:00:00", + "2017-08-25 19:05:00", + "2017-08-25 19:10:00", + "2017-08-25 19:15:00", + "2017-08-25 19:20:00", + "2017-08-25 19:25:00", + "2017-08-25 19:30:00", + "2017-08-25 19:35:00", + "2017-08-25 19:40:00", + "2017-08-25 19:45:00", + "2017-08-25 19:50:00", + "2017-08-25 19:55:00", + "2017-08-25 20:00:00", + "2017-08-25 20:05:00", + "2017-08-25 20:10:00", + "2017-08-25 20:15:00", + "2017-08-25 20:20:00", + "2017-08-25 20:25:00", + "2017-08-25 20:30:00", + "2017-08-25 20:35:00", + "2017-08-25 20:40:00", + "2017-08-25 20:45:00", + "2017-08-25 20:50:00", + "2017-08-25 20:55:00", + "2017-08-25 21:00:00", + "2017-08-25 21:05:00", + "2017-08-25 21:10:00", + "2017-08-25 21:15:00", + "2017-08-25 21:20:00", + "2017-08-25 21:25:00", + "2017-08-25 21:30:00", + "2017-08-25 21:35:00", + "2017-08-25 21:40:00", + "2017-08-25 21:45:00", + "2017-08-25 21:50:00", + "2017-08-25 21:55:00", + "2017-08-25 22:00:00", + "2017-08-25 22:05:00", + "2017-08-25 22:10:00", + "2017-08-25 22:15:00", + "2017-08-25 22:20:00", + "2017-08-25 22:25:00", + "2017-08-25 22:30:00", + "2017-08-25 22:35:00", + "2017-08-25 22:40:00", + "2017-08-25 22:45:00", + "2017-08-25 22:50:00", + "2017-08-25 22:55:00", + "2017-08-25 23:00:00", + "2017-08-25 23:05:00", + "2017-08-25 23:10:00", + "2017-08-25 23:15:00", + "2017-08-25 23:20:00", + "2017-08-25 23:25:00", + "2017-08-25 23:30:00", + "2017-08-25 23:35:00", + "2017-08-25 23:40:00", + "2017-08-25 23:45:00", + "2017-08-25 23:50:00", + "2017-08-25 23:55:00", + "2017-08-31 00:00:00", + "2017-08-31 00:05:00", + "2017-08-31 00:10:00", + "2017-08-31 00:15:00", + "2017-08-31 00:25:00", + "2017-08-31 00:30:00", + "2017-08-31 00:35:00", + "2017-08-31 00:40:00", + "2017-08-31 00:45:00", + "2017-08-31 00:50:00", + "2017-08-31 01:00:00", + "2017-08-31 01:05:00", + "2017-08-31 01:10:00", + "2017-08-31 01:15:00", + "2017-08-31 01:20:00", + "2017-08-31 01:25:00", + "2017-08-31 01:35:00", + "2017-08-31 01:40:00", + "2017-08-31 01:45:00", + "2017-08-31 01:50:00", + "2017-08-31 01:55:00", + "2017-08-31 02:00:00", + "2017-08-31 02:05:00", + "2017-08-31 02:10:00", + "2017-08-31 02:15:00", + "2017-08-31 02:25:00", + "2017-08-31 02:35:00", + "2017-08-31 02:40:00", + "2017-08-31 02:45:00", + "2017-08-31 02:50:00", + "2017-08-31 02:55:00", + "2017-08-31 03:05:00", + "2017-08-31 03:15:00", + "2017-08-31 03:20:00", + "2017-08-31 03:25:00", + "2017-08-31 03:35:00", + "2017-08-31 03:45:00", + "2017-08-31 03:50:00", + "2017-08-31 03:55:00", + "2017-08-31 04:00:00", + "2017-08-31 04:05:00", + "2017-08-31 04:10:00", + "2017-08-31 04:15:00", + "2017-08-31 04:20:00", + "2017-08-31 04:25:00", + "2017-08-31 04:30:00", + "2017-08-31 04:35:00", + "2017-08-31 04:40:00", + "2017-08-31 04:50:00", + "2017-08-31 05:00:00", + "2017-08-31 05:05:00", + "2017-08-31 05:10:00", + "2017-08-31 05:15:00", + "2017-08-31 05:20:00", + "2017-08-31 05:25:00", + "2017-08-31 05:30:00", + "2017-08-31 05:35:00", + "2017-08-31 05:40:00", + "2017-08-31 05:45:00", + "2017-08-31 05:50:00", + "2017-08-31 05:55:00", + "2017-08-31 06:00:00", + "2017-08-31 06:05:00", + "2017-08-31 06:15:00", + "2017-08-31 06:20:00", + "2017-08-31 06:25:00", + "2017-08-31 06:30:00", + "2017-08-31 06:35:00", + "2017-08-31 06:40:00", + "2017-08-31 06:45:00", + "2017-08-31 06:50:00", + "2017-08-31 06:55:00", + "2017-08-31 07:00:00", + "2017-08-31 07:05:00", + "2017-08-31 07:10:00", + "2017-08-31 07:15:00", + "2017-08-31 07:20:00", + "2017-08-31 07:25:00", + "2017-08-31 07:30:00", + "2017-08-31 07:35:00", + "2017-08-31 07:40:00", + "2017-08-31 07:45:00", + "2017-08-31 07:50:00", + "2017-08-31 07:55:00", + "2017-08-31 08:00:00", + "2017-08-31 08:05:00", + "2017-08-31 08:10:00", + "2017-08-31 08:15:00", + "2017-08-31 08:20:00", + "2017-08-31 08:25:00", + "2017-08-31 08:30:00", + "2017-08-31 08:35:00", + "2017-08-31 08:40:00", + "2017-08-31 08:45:00", + "2017-08-31 08:50:00", + "2017-08-31 08:55:00", + "2017-08-31 09:00:00", + "2017-08-31 09:05:00", + "2017-08-31 09:10:00", + "2017-08-31 09:15:00", + "2017-08-31 09:20:00", + "2017-08-31 09:25:00", + "2017-08-31 09:30:00", + "2017-08-31 09:35:00", + "2017-08-31 09:40:00", + "2017-08-31 09:45:00", + "2017-08-31 09:50:00", + "2017-08-31 09:55:00", + "2017-08-31 10:00:00", + "2017-08-31 10:05:00", + "2017-08-31 10:10:00", + "2017-08-31 10:15:00", + "2017-08-31 10:20:00", + "2017-08-31 10:25:00", + "2017-08-31 10:30:00", + "2017-08-31 10:35:00", + "2017-08-31 10:40:00", + "2017-08-31 10:45:00", + "2017-08-31 10:50:00", + "2017-08-31 10:55:00", + "2017-08-31 11:00:00", + "2017-08-31 11:05:00", + "2017-08-31 11:10:00", + "2017-08-31 11:15:00", + "2017-08-31 11:20:00", + "2017-08-31 11:25:00", + "2017-08-31 11:30:00", + "2017-08-31 11:35:00", + "2017-08-31 11:40:00", + "2017-08-31 11:45:00", + "2017-08-31 11:50:00", + "2017-08-31 11:55:00", + "2017-08-31 12:00:00", + "2017-08-31 12:05:00", + "2017-08-31 12:10:00", + "2017-08-31 12:15:00", + "2017-08-31 12:20:00", + "2017-08-31 12:25:00", + "2017-08-31 12:30:00", + "2017-08-31 12:35:00", + "2017-08-31 12:40:00", + "2017-08-31 12:45:00", + "2017-08-31 12:50:00", + "2017-08-31 12:55:00", + "2017-08-31 13:00:00", + "2017-08-31 13:05:00", + "2017-08-31 13:10:00", + "2017-08-31 13:15:00", + "2017-08-31 13:20:00", + "2017-08-31 13:25:00", + "2017-08-31 13:30:00", + "2017-08-31 13:35:00", + "2017-08-31 13:40:00", + "2017-08-31 13:45:00", + "2017-08-31 13:50:00", + "2017-08-31 13:55:00", + "2017-08-31 14:00:00", + "2017-08-31 14:05:00", + "2017-08-31 14:10:00", + "2017-08-31 14:15:00", + "2017-08-31 14:20:00", + "2017-08-31 14:25:00", + "2017-08-31 14:30:00", + "2017-08-31 14:35:00", + "2017-08-31 14:40:00", + "2017-08-31 14:45:00", + "2017-08-31 14:50:00", + "2017-08-31 14:55:00", + "2017-08-31 15:00:00", + "2017-08-31 15:05:00", + "2017-08-31 15:10:00", + "2017-08-31 15:15:00", + "2017-08-31 15:20:00", + "2017-08-31 15:25:00", + "2017-08-31 15:30:00", + "2017-08-31 15:35:00", + "2017-08-31 15:40:00", + "2017-08-31 15:45:00", + "2017-08-31 15:50:00", + "2017-08-31 15:55:00", + "2017-08-31 16:00:00", + "2017-08-31 16:05:00", + "2017-08-31 16:10:00", + "2017-08-31 16:15:00", + "2017-08-31 16:20:00", + "2017-08-31 16:25:00", + "2017-08-31 16:30:00", + "2017-08-31 16:35:00", + "2017-08-31 16:40:00", + "2017-08-31 16:45:00", + "2017-08-31 16:50:00", + "2017-08-31 16:55:00", + "2017-08-31 17:00:00", + "2017-08-31 17:05:00", + "2017-08-31 17:10:00", + "2017-08-31 17:15:00", + "2017-08-31 17:20:00", + "2017-08-31 17:25:00", + "2017-08-31 17:30:00", + "2017-08-31 17:35:00", + "2017-08-31 17:40:00", + "2017-08-31 17:45:00", + "2017-08-31 17:50:00", + "2017-08-31 17:55:00", + "2017-08-31 18:00:00", + "2017-08-31 18:05:00", + "2017-08-31 18:10:00", + "2017-08-31 18:15:00", + "2017-08-31 18:20:00", + "2017-08-31 18:25:00", + "2017-08-31 18:30:00", + "2017-08-31 18:35:00", + "2017-08-31 18:40:00", + "2017-08-31 18:45:00", + "2017-08-31 18:50:00", + "2017-08-31 18:55:00", + "2017-08-31 19:00:00", + "2017-08-31 19:05:00", + "2017-08-31 19:10:00", + "2017-08-31 19:15:00", + "2017-08-31 19:20:00", + "2017-08-31 19:25:00", + "2017-08-31 19:30:00", + "2017-08-31 19:35:00", + "2017-08-31 19:40:00", + "2017-08-31 19:45:00", + "2017-08-31 19:50:00", + "2017-08-31 19:55:00", + "2017-08-31 20:00:00", + "2017-08-31 20:05:00", + "2017-08-31 20:10:00", + "2017-08-31 20:15:00", + "2017-08-31 20:20:00", + "2017-08-31 20:25:00", + "2017-08-31 20:30:00", + "2017-08-31 20:35:00", + "2017-08-31 20:40:00", + "2017-08-31 20:45:00", + "2017-08-31 20:50:00", + "2017-08-31 20:55:00", + "2017-08-31 21:00:00", + "2017-08-31 21:05:00", + "2017-08-31 21:10:00", + "2017-08-31 21:15:00", + "2017-08-31 21:20:00", + "2017-08-31 21:25:00", + "2017-08-31 21:30:00", + "2017-08-31 21:35:00", + "2017-08-31 21:40:00", + "2017-08-31 21:45:00", + "2017-08-31 21:50:00", + "2017-08-31 21:55:00", + "2017-08-31 22:00:00", + "2017-08-31 22:05:00", + "2017-08-31 22:10:00", + "2017-08-31 22:15:00", + "2017-08-31 22:20:00", + "2017-08-31 22:25:00", + "2017-08-31 22:30:00", + "2017-08-31 22:35:00", + "2017-08-31 22:40:00", + "2017-08-31 22:45:00", + "2017-08-31 22:50:00", + "2017-08-31 22:55:00", + "2017-08-31 23:00:00", + "2017-08-31 23:05:00", + "2017-08-31 23:10:00", + "2017-08-31 23:15:00", + "2017-08-31 23:20:00", + "2017-08-31 23:25:00", + "2017-08-31 23:30:00", + "2017-08-31 23:35:00", + "2017-08-31 23:40:00", + "2017-08-31 23:45:00", + "2017-08-31 23:50:00", + "2017-08-31 23:55:00", + "2017-09-01 00:00:00", + "2017-09-01 00:05:00", + "2017-09-01 00:10:00", + "2017-09-01 00:15:00", + "2017-09-01 00:20:00", + "2017-09-01 00:25:00", + "2017-09-01 00:30:00", + "2017-09-01 00:35:00", + "2017-09-01 00:40:00", + "2017-09-01 00:45:00", + "2017-09-01 00:50:00", + "2017-09-01 00:55:00", + "2017-09-01 01:00:00", + "2017-09-01 01:05:00", + "2017-09-01 01:10:00", + "2017-09-01 01:15:00", + "2017-09-01 01:20:00", + "2017-09-01 01:25:00", + "2017-09-01 01:35:00", + "2017-09-01 01:40:00", + "2017-09-01 01:45:00", + "2017-09-01 01:55:00", + "2017-09-01 02:00:00", + "2017-09-01 02:10:00", + "2017-09-01 02:15:00", + "2017-09-01 02:20:00", + "2017-09-01 02:25:00", + "2017-09-01 02:30:00", + "2017-09-01 02:40:00", + "2017-09-01 02:45:00", + "2017-09-01 02:50:00", + "2017-09-01 02:55:00", + "2017-09-01 03:00:00", + "2017-09-01 03:10:00", + "2017-09-01 03:25:00", + "2017-09-01 03:30:00", + "2017-09-01 03:35:00", + "2017-09-01 03:40:00", + "2017-09-01 03:45:00", + "2017-09-01 04:00:00", + "2017-09-01 04:05:00", + "2017-09-01 04:20:00", + "2017-09-01 04:40:00", + "2017-09-01 04:45:00", + "2017-09-01 04:55:00", + "2017-09-01 05:00:00", + "2017-09-01 05:10:00", + "2017-09-01 05:15:00", + "2017-09-01 05:25:00", + "2017-09-01 05:30:00", + "2017-09-01 05:35:00", + "2017-09-01 05:40:00", + "2017-09-01 05:45:00", + "2017-09-01 05:50:00", + "2017-09-01 05:55:00", + "2017-09-01 06:00:00", + "2017-09-01 06:05:00", + "2017-09-01 06:10:00", + "2017-09-01 06:15:00", + "2017-09-01 06:25:00", + "2017-09-01 06:30:00", + "2017-09-01 06:35:00", + "2017-09-01 06:40:00", + "2017-09-01 06:45:00", + "2017-09-01 06:50:00", + "2017-09-01 06:55:00", + "2017-09-01 07:00:00", + "2017-09-01 07:05:00", + "2017-09-01 07:10:00", + "2017-09-01 07:15:00", + "2017-09-01 07:20:00", + "2017-09-01 07:25:00", + "2017-09-01 07:30:00", + "2017-09-01 07:35:00", + "2017-09-01 07:40:00", + "2017-09-01 07:45:00", + "2017-09-01 07:50:00", + "2017-09-01 07:55:00", + "2017-09-01 08:00:00", + "2017-09-01 08:05:00", + "2017-09-01 08:10:00", + "2017-09-01 08:15:00", + "2017-09-01 08:20:00", + "2017-09-01 08:25:00", + "2017-09-01 08:30:00", + "2017-09-01 08:35:00", + "2017-09-01 08:40:00", + "2017-09-01 08:45:00", + "2017-09-01 08:50:00", + "2017-09-01 08:55:00", + "2017-09-01 09:00:00", + "2017-09-01 09:05:00", + "2017-09-01 09:10:00", + "2017-09-01 09:15:00", + "2017-09-01 09:20:00", + "2017-09-01 09:25:00", + "2017-09-01 09:30:00", + "2017-09-01 09:35:00", + "2017-09-01 09:40:00", + "2017-09-01 09:45:00", + "2017-09-01 09:50:00", + "2017-09-01 09:55:00", + "2017-09-01 10:00:00", + "2017-09-01 10:05:00", + "2017-09-01 10:10:00", + "2017-09-01 10:15:00", + "2017-09-01 10:20:00", + "2017-09-01 10:25:00", + "2017-09-01 10:30:00", + "2017-09-01 10:35:00", + "2017-09-01 10:40:00", + "2017-09-01 10:45:00", + "2017-09-01 10:50:00", + "2017-09-01 10:55:00", + "2017-09-01 11:00:00", + "2017-09-01 11:05:00", + "2017-09-01 11:10:00", + "2017-09-01 11:15:00", + "2017-09-01 11:20:00", + "2017-09-01 11:25:00", + "2017-09-01 11:30:00", + "2017-09-01 11:35:00", + "2017-09-01 11:40:00", + "2017-09-01 11:45:00", + "2017-09-01 11:50:00", + "2017-09-01 11:55:00", + "2017-09-01 12:00:00", + "2017-09-01 12:05:00", + "2017-09-01 12:10:00", + "2017-09-01 12:15:00", + "2017-09-01 12:20:00", + "2017-09-01 12:25:00", + "2017-09-01 12:30:00", + "2017-09-01 12:35:00", + "2017-09-01 12:40:00", + "2017-09-01 12:45:00", + "2017-09-01 12:50:00", + "2017-09-01 12:55:00", + "2017-09-01 13:00:00", + "2017-09-01 13:05:00", + "2017-09-01 13:10:00", + "2017-09-01 13:15:00", + "2017-09-01 13:20:00", + "2017-09-01 13:25:00", + "2017-09-01 13:30:00", + "2017-09-01 13:35:00", + "2017-09-01 13:40:00", + "2017-09-01 13:45:00", + "2017-09-01 13:50:00", + "2017-09-01 13:55:00", + "2017-09-01 14:00:00", + "2017-09-01 14:05:00", + "2017-09-01 14:10:00", + "2017-09-01 14:15:00", + "2017-09-01 14:20:00", + "2017-09-01 14:25:00", + "2017-09-01 14:30:00", + "2017-09-01 14:35:00", + "2017-09-01 14:40:00", + "2017-09-01 14:45:00", + "2017-09-01 14:50:00", + "2017-09-01 14:55:00", + "2017-09-01 15:00:00", + "2017-09-01 15:05:00", + "2017-09-01 15:10:00", + "2017-09-01 15:15:00", + "2017-09-01 15:20:00", + "2017-09-01 15:25:00", + "2017-09-01 15:30:00", + "2017-09-01 15:35:00", + "2017-09-01 15:40:00", + "2017-09-01 15:45:00", + "2017-09-01 15:50:00", + "2017-09-01 15:55:00", + "2017-09-01 16:00:00", + "2017-09-01 16:05:00", + "2017-09-01 16:10:00", + "2017-09-01 16:15:00", + "2017-09-01 16:20:00", + "2017-09-01 16:25:00", + "2017-09-01 16:30:00", + "2017-09-01 16:35:00", + "2017-09-01 16:40:00", + "2017-09-01 16:45:00", + "2017-09-01 16:50:00", + "2017-09-01 16:55:00", + "2017-09-01 17:00:00", + "2017-09-01 17:05:00", + "2017-09-01 17:10:00", + "2017-09-01 17:15:00", + "2017-09-01 17:20:00", + "2017-09-01 17:25:00", + "2017-09-01 17:30:00", + "2017-09-01 17:35:00", + "2017-09-01 17:40:00", + "2017-09-01 17:45:00", + "2017-09-01 17:50:00", + "2017-09-01 17:55:00", + "2017-09-01 18:00:00", + "2017-09-01 18:05:00", + "2017-09-01 18:10:00", + "2017-09-01 18:15:00", + "2017-09-01 18:20:00", + "2017-09-01 18:25:00", + "2017-09-01 18:30:00", + "2017-09-01 18:35:00", + "2017-09-01 18:40:00", + "2017-09-01 18:45:00", + "2017-09-01 18:50:00", + "2017-09-01 18:55:00", + "2017-09-01 19:00:00", + "2017-09-01 19:05:00", + "2017-09-01 19:10:00", + "2017-09-01 19:15:00", + "2017-09-01 19:20:00", + "2017-09-01 19:25:00", + "2017-09-01 19:30:00", + "2017-09-01 19:35:00", + "2017-09-01 19:40:00", + "2017-09-01 19:45:00", + "2017-09-01 19:50:00", + "2017-09-01 19:55:00", + "2017-09-01 20:00:00", + "2017-09-01 20:05:00", + "2017-09-01 20:10:00", + "2017-09-01 20:15:00", + "2017-09-01 20:20:00", + "2017-09-01 20:25:00", + "2017-09-01 20:30:00", + "2017-09-01 20:35:00", + "2017-09-01 20:40:00", + "2017-09-01 20:45:00", + "2017-09-01 20:50:00", + "2017-09-01 20:55:00", + "2017-09-01 21:00:00", + "2017-09-01 21:05:00", + "2017-09-01 21:10:00", + "2017-09-01 21:15:00", + "2017-09-01 21:20:00", + "2017-09-01 21:25:00", + "2017-09-01 21:30:00", + "2017-09-01 21:35:00", + "2017-09-01 21:40:00", + "2017-09-01 21:45:00", + "2017-09-01 21:50:00", + "2017-09-01 21:55:00", + "2017-09-01 22:00:00", + "2017-09-01 22:05:00", + "2017-09-01 22:10:00", + "2017-09-01 22:15:00", + "2017-09-01 22:20:00", + "2017-09-01 22:25:00", + "2017-09-01 22:30:00", + "2017-09-01 22:35:00", + "2017-09-01 22:40:00", + "2017-09-01 22:45:00", + "2017-09-01 22:50:00", + "2017-09-01 22:55:00", + "2017-09-01 23:00:00", + "2017-09-01 23:05:00", + "2017-09-01 23:10:00", + "2017-09-01 23:15:00", + "2017-09-01 23:20:00", + "2017-09-01 23:25:00", + "2017-09-01 23:30:00", + "2017-09-01 23:35:00", + "2017-09-01 23:45:00", + "2017-09-01 23:50:00", + "2017-09-01 23:55:00" + ], + "y": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 4, + 4, + 8, + 2, + 4, + 2, + 3, + 4, + 2, + 4, + 2, + 1, + 1, + 2, + 3, + 1, + 1, + 1, + 3, + 1, + 1, + 1, + 3, + 4, + 3, + 1, + 3, + 2, + 2, + 3, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 2, + 5, + 1, + 2, + 2, + 1, + 1, + 1, + 3, + 1, + 5, + 2, + 2, + 2, + 3, + 2, + 2, + 1, + 3, + 2, + 4, + 4, + 3, + 6, + 1, + 3, + 2, + 6, + 4, + 4, + 6, + 5, + 4, + 5, + 6, + 7, + 2, + 3, + 4, + 8, + 11, + 9, + 9, + 9, + 9, + 7, + 10, + 10, + 10, + 9, + 11, + 12, + 13, + 9, + 14, + 11, + 10, + 12, + 9, + 18, + 12, + 17, + 16, + 19, + 22, + 20, + 15, + 19, + 16, + 33, + 18, + 18, + 14, + 28, + 15, + 19, + 18, + 18, + 14, + 17, + 23, + 20, + 10, + 21, + 16, + 15, + 23, + 15, + 31, + 19, + 17, + 20, + 23, + 18, + 21, + 13, + 24, + 17, + 14, + 15, + 19, + 21, + 23, + 18, + 13, + 22, + 17, + 22, + 11, + 17, + 14, + 21, + 18, + 19, + 14, + 15, + 20, + 20, + 20, + 20, + 23, + 19, + 14, + 18, + 14, + 9, + 22, + 11, + 22, + 26, + 23, + 19, + 10, + 15, + 16, + 19, + 19, + 21, + 18, + 21, + 21, + 9, + 19, + 16, + 14, + 11, + 15, + 13, + 12, + 20, + 11, + 15, + 18, + 15, + 15, + 14, + 8, + 12, + 10, + 15, + 11, + 11, + 10, + 17, + 7, + 4, + 8, + 10, + 4, + 6, + 5, + 11, + 7, + 8, + 6, + 10, + 8, + 7, + 6, + 4, + 10, + 19, + 5, + 11, + 3, + 9, + 5, + 4, + 6, + 5, + 6, + 3, + 6, + 3, + 7, + 9, + 6, + 8, + 8, + 5, + 7, + 4, + 6, + 5, + 5, + 6, + 6, + 6, + 6, + 4, + 7, + 7, + 7, + 4, + 2, + 3, + 2, + 2, + 6, + 11, + 6, + 8, + 4, + 4, + 4, + 6, + 3, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + { + "mode": "lines", + "name": "prev_week_visits", + "type": "scatter", + "x": [ + "2017-08-25 00:00:00", + "2017-08-25 00:05:00", + "2017-08-25 00:10:00", + "2017-08-25 00:15:00", + "2017-08-25 00:20:00", + "2017-08-25 00:30:00", + "2017-08-25 00:35:00", + "2017-08-25 00:40:00", + "2017-08-25 00:45:00", + "2017-08-25 00:50:00", + "2017-08-25 00:55:00", + "2017-08-25 01:00:00", + "2017-08-25 01:05:00", + "2017-08-25 01:20:00", + "2017-08-25 01:25:00", + "2017-08-25 01:35:00", + "2017-08-25 01:45:00", + "2017-08-25 01:55:00", + "2017-08-25 02:00:00", + "2017-08-25 02:05:00", + "2017-08-25 02:10:00", + "2017-08-25 02:15:00", + "2017-08-25 02:20:00", + "2017-08-25 02:25:00", + "2017-08-25 02:45:00", + "2017-08-25 02:50:00", + "2017-08-25 03:10:00", + "2017-08-25 03:15:00", + "2017-08-25 03:20:00", + "2017-08-25 03:30:00", + "2017-08-25 03:40:00", + "2017-08-25 03:45:00", + "2017-08-25 03:55:00", + "2017-08-25 04:00:00", + "2017-08-25 04:05:00", + "2017-08-25 04:15:00", + "2017-08-25 04:25:00", + "2017-08-25 04:30:00", + "2017-08-25 04:35:00", + "2017-08-25 04:40:00", + "2017-08-25 04:50:00", + "2017-08-25 04:55:00", + "2017-08-25 05:05:00", + "2017-08-25 05:10:00", + "2017-08-25 05:15:00", + "2017-08-25 05:25:00", + "2017-08-25 05:30:00", + "2017-08-25 05:35:00", + "2017-08-25 05:40:00", + "2017-08-25 05:45:00", + "2017-08-25 05:50:00", + "2017-08-25 05:55:00", + "2017-08-25 06:05:00", + "2017-08-25 06:10:00", + "2017-08-25 06:15:00", + "2017-08-25 06:20:00", + "2017-08-25 06:25:00", + "2017-08-25 06:30:00", + "2017-08-25 06:35:00", + "2017-08-25 06:40:00", + "2017-08-25 06:45:00", + "2017-08-25 06:50:00", + "2017-08-25 06:55:00", + "2017-08-25 07:00:00", + "2017-08-25 07:05:00", + "2017-08-25 07:10:00", + "2017-08-25 07:15:00", + "2017-08-25 07:20:00", + "2017-08-25 07:25:00", + "2017-08-25 07:30:00", + "2017-08-25 07:35:00", + "2017-08-25 07:40:00", + "2017-08-25 07:45:00", + "2017-08-25 07:50:00", + "2017-08-25 07:55:00", + "2017-08-25 08:00:00", + "2017-08-25 08:05:00", + "2017-08-25 08:10:00", + "2017-08-25 08:15:00", + "2017-08-25 08:20:00", + "2017-08-25 08:25:00", + "2017-08-25 08:30:00", + "2017-08-25 08:35:00", + "2017-08-25 08:40:00", + "2017-08-25 08:45:00", + "2017-08-25 08:50:00", + "2017-08-25 08:55:00", + "2017-08-25 09:00:00", + "2017-08-25 09:05:00", + "2017-08-25 09:10:00", + "2017-08-25 09:15:00", + "2017-08-25 09:20:00", + "2017-08-25 09:25:00", + "2017-08-25 09:30:00", + "2017-08-25 09:35:00", + "2017-08-25 09:40:00", + "2017-08-25 09:45:00", + "2017-08-25 09:50:00", + "2017-08-25 09:55:00", + "2017-08-25 10:00:00", + "2017-08-25 10:05:00", + "2017-08-25 10:10:00", + "2017-08-25 10:15:00", + "2017-08-25 10:20:00", + "2017-08-25 10:25:00", + "2017-08-25 10:30:00", + "2017-08-25 10:35:00", + "2017-08-25 10:40:00", + "2017-08-25 10:45:00", + "2017-08-25 10:50:00", + "2017-08-25 10:55:00", + "2017-08-25 11:00:00", + "2017-08-25 11:05:00", + "2017-08-25 11:10:00", + "2017-08-25 11:15:00", + "2017-08-25 11:20:00", + "2017-08-25 11:25:00", + "2017-08-25 11:30:00", + "2017-08-25 11:35:00", + "2017-08-25 11:40:00", + "2017-08-25 11:45:00", + "2017-08-25 11:50:00", + "2017-08-25 11:55:00", + "2017-08-25 12:00:00", + "2017-08-25 12:05:00", + "2017-08-25 12:10:00", + "2017-08-25 12:15:00", + "2017-08-25 12:20:00", + "2017-08-25 12:25:00", + "2017-08-25 12:30:00", + "2017-08-25 12:35:00", + "2017-08-25 12:40:00", + "2017-08-25 12:45:00", + "2017-08-25 12:50:00", + "2017-08-25 12:55:00", + "2017-08-25 13:00:00", + "2017-08-25 13:05:00", + "2017-08-25 13:10:00", + "2017-08-25 13:15:00", + "2017-08-25 13:20:00", + "2017-08-25 13:25:00", + "2017-08-25 13:30:00", + "2017-08-25 13:35:00", + "2017-08-25 13:40:00", + "2017-08-25 13:45:00", + "2017-08-25 13:50:00", + "2017-08-25 13:55:00", + "2017-08-25 14:00:00", + "2017-08-25 14:05:00", + "2017-08-25 14:10:00", + "2017-08-25 14:15:00", + "2017-08-25 14:20:00", + "2017-08-25 14:25:00", + "2017-08-25 14:30:00", + "2017-08-25 14:35:00", + "2017-08-25 14:40:00", + "2017-08-25 14:45:00", + "2017-08-25 14:50:00", + "2017-08-25 14:55:00", + "2017-08-25 15:00:00", + "2017-08-25 15:05:00", + "2017-08-25 15:10:00", + "2017-08-25 15:15:00", + "2017-08-25 15:20:00", + "2017-08-25 15:25:00", + "2017-08-25 15:30:00", + "2017-08-25 15:35:00", + "2017-08-25 15:40:00", + "2017-08-25 15:45:00", + "2017-08-25 15:50:00", + "2017-08-25 15:55:00", + "2017-08-25 16:00:00", + "2017-08-25 16:05:00", + "2017-08-25 16:10:00", + "2017-08-25 16:15:00", + "2017-08-25 16:20:00", + "2017-08-25 16:25:00", + "2017-08-25 16:30:00", + "2017-08-25 16:35:00", + "2017-08-25 16:40:00", + "2017-08-25 16:45:00", + "2017-08-25 16:50:00", + "2017-08-25 16:55:00", + "2017-08-25 17:00:00", + "2017-08-25 17:05:00", + "2017-08-25 17:10:00", + "2017-08-25 17:15:00", + "2017-08-25 17:20:00", + "2017-08-25 17:25:00", + "2017-08-25 17:30:00", + "2017-08-25 17:35:00", + "2017-08-25 17:40:00", + "2017-08-25 17:45:00", + "2017-08-25 17:50:00", + "2017-08-25 17:55:00", + "2017-08-25 18:00:00", + "2017-08-25 18:05:00", + "2017-08-25 18:10:00", + "2017-08-25 18:15:00", + "2017-08-25 18:20:00", + "2017-08-25 18:25:00", + "2017-08-25 18:30:00", + "2017-08-25 18:35:00", + "2017-08-25 18:40:00", + "2017-08-25 18:45:00", + "2017-08-25 18:50:00", + "2017-08-25 18:55:00", + "2017-08-25 19:00:00", + "2017-08-25 19:05:00", + "2017-08-25 19:10:00", + "2017-08-25 19:15:00", + "2017-08-25 19:20:00", + "2017-08-25 19:25:00", + "2017-08-25 19:30:00", + "2017-08-25 19:35:00", + "2017-08-25 19:40:00", + "2017-08-25 19:45:00", + "2017-08-25 19:50:00", + "2017-08-25 19:55:00", + "2017-08-25 20:00:00", + "2017-08-25 20:05:00", + "2017-08-25 20:10:00", + "2017-08-25 20:15:00", + "2017-08-25 20:20:00", + "2017-08-25 20:25:00", + "2017-08-25 20:30:00", + "2017-08-25 20:35:00", + "2017-08-25 20:40:00", + "2017-08-25 20:45:00", + "2017-08-25 20:50:00", + "2017-08-25 20:55:00", + "2017-08-25 21:00:00", + "2017-08-25 21:05:00", + "2017-08-25 21:10:00", + "2017-08-25 21:15:00", + "2017-08-25 21:20:00", + "2017-08-25 21:25:00", + "2017-08-25 21:30:00", + "2017-08-25 21:35:00", + "2017-08-25 21:40:00", + "2017-08-25 21:45:00", + "2017-08-25 21:50:00", + "2017-08-25 21:55:00", + "2017-08-25 22:00:00", + "2017-08-25 22:05:00", + "2017-08-25 22:10:00", + "2017-08-25 22:15:00", + "2017-08-25 22:20:00", + "2017-08-25 22:25:00", + "2017-08-25 22:30:00", + "2017-08-25 22:35:00", + "2017-08-25 22:40:00", + "2017-08-25 22:45:00", + "2017-08-25 22:50:00", + "2017-08-25 22:55:00", + "2017-08-25 23:00:00", + "2017-08-25 23:05:00", + "2017-08-25 23:10:00", + "2017-08-25 23:15:00", + "2017-08-25 23:20:00", + "2017-08-25 23:25:00", + "2017-08-25 23:30:00", + "2017-08-25 23:35:00", + "2017-08-25 23:40:00", + "2017-08-25 23:45:00", + "2017-08-25 23:50:00", + "2017-08-25 23:55:00", + "2017-08-31 00:00:00", + "2017-08-31 00:05:00", + "2017-08-31 00:10:00", + "2017-08-31 00:15:00", + "2017-08-31 00:25:00", + "2017-08-31 00:30:00", + "2017-08-31 00:35:00", + "2017-08-31 00:40:00", + "2017-08-31 00:45:00", + "2017-08-31 00:50:00", + "2017-08-31 01:00:00", + "2017-08-31 01:05:00", + "2017-08-31 01:10:00", + "2017-08-31 01:15:00", + "2017-08-31 01:20:00", + "2017-08-31 01:25:00", + "2017-08-31 01:35:00", + "2017-08-31 01:40:00", + "2017-08-31 01:45:00", + "2017-08-31 01:50:00", + "2017-08-31 01:55:00", + "2017-08-31 02:00:00", + "2017-08-31 02:05:00", + "2017-08-31 02:10:00", + "2017-08-31 02:15:00", + "2017-08-31 02:25:00", + "2017-08-31 02:35:00", + "2017-08-31 02:40:00", + "2017-08-31 02:45:00", + "2017-08-31 02:50:00", + "2017-08-31 02:55:00", + "2017-08-31 03:05:00", + "2017-08-31 03:15:00", + "2017-08-31 03:20:00", + "2017-08-31 03:25:00", + "2017-08-31 03:35:00", + "2017-08-31 03:45:00", + "2017-08-31 03:50:00", + "2017-08-31 03:55:00", + "2017-08-31 04:00:00", + "2017-08-31 04:05:00", + "2017-08-31 04:10:00", + "2017-08-31 04:15:00", + "2017-08-31 04:20:00", + "2017-08-31 04:25:00", + "2017-08-31 04:30:00", + "2017-08-31 04:35:00", + "2017-08-31 04:40:00", + "2017-08-31 04:50:00", + "2017-08-31 05:00:00", + "2017-08-31 05:05:00", + "2017-08-31 05:10:00", + "2017-08-31 05:15:00", + "2017-08-31 05:20:00", + "2017-08-31 05:25:00", + "2017-08-31 05:30:00", + "2017-08-31 05:35:00", + "2017-08-31 05:40:00", + "2017-08-31 05:45:00", + "2017-08-31 05:50:00", + "2017-08-31 05:55:00", + "2017-08-31 06:00:00", + "2017-08-31 06:05:00", + "2017-08-31 06:15:00", + "2017-08-31 06:20:00", + "2017-08-31 06:25:00", + "2017-08-31 06:30:00", + "2017-08-31 06:35:00", + "2017-08-31 06:40:00", + "2017-08-31 06:45:00", + "2017-08-31 06:50:00", + "2017-08-31 06:55:00", + "2017-08-31 07:00:00", + "2017-08-31 07:05:00", + "2017-08-31 07:10:00", + "2017-08-31 07:15:00", + "2017-08-31 07:20:00", + "2017-08-31 07:25:00", + "2017-08-31 07:30:00", + "2017-08-31 07:35:00", + "2017-08-31 07:40:00", + "2017-08-31 07:45:00", + "2017-08-31 07:50:00", + "2017-08-31 07:55:00", + "2017-08-31 08:00:00", + "2017-08-31 08:05:00", + "2017-08-31 08:10:00", + "2017-08-31 08:15:00", + "2017-08-31 08:20:00", + "2017-08-31 08:25:00", + "2017-08-31 08:30:00", + "2017-08-31 08:35:00", + "2017-08-31 08:40:00", + "2017-08-31 08:45:00", + "2017-08-31 08:50:00", + "2017-08-31 08:55:00", + "2017-08-31 09:00:00", + "2017-08-31 09:05:00", + "2017-08-31 09:10:00", + "2017-08-31 09:15:00", + "2017-08-31 09:20:00", + "2017-08-31 09:25:00", + "2017-08-31 09:30:00", + "2017-08-31 09:35:00", + "2017-08-31 09:40:00", + "2017-08-31 09:45:00", + "2017-08-31 09:50:00", + "2017-08-31 09:55:00", + "2017-08-31 10:00:00", + "2017-08-31 10:05:00", + "2017-08-31 10:10:00", + "2017-08-31 10:15:00", + "2017-08-31 10:20:00", + "2017-08-31 10:25:00", + "2017-08-31 10:30:00", + "2017-08-31 10:35:00", + "2017-08-31 10:40:00", + "2017-08-31 10:45:00", + "2017-08-31 10:50:00", + "2017-08-31 10:55:00", + "2017-08-31 11:00:00", + "2017-08-31 11:05:00", + "2017-08-31 11:10:00", + "2017-08-31 11:15:00", + "2017-08-31 11:20:00", + "2017-08-31 11:25:00", + "2017-08-31 11:30:00", + "2017-08-31 11:35:00", + "2017-08-31 11:40:00", + "2017-08-31 11:45:00", + "2017-08-31 11:50:00", + "2017-08-31 11:55:00", + "2017-08-31 12:00:00", + "2017-08-31 12:05:00", + "2017-08-31 12:10:00", + "2017-08-31 12:15:00", + "2017-08-31 12:20:00", + "2017-08-31 12:25:00", + "2017-08-31 12:30:00", + "2017-08-31 12:35:00", + "2017-08-31 12:40:00", + "2017-08-31 12:45:00", + "2017-08-31 12:50:00", + "2017-08-31 12:55:00", + "2017-08-31 13:00:00", + "2017-08-31 13:05:00", + "2017-08-31 13:10:00", + "2017-08-31 13:15:00", + "2017-08-31 13:20:00", + "2017-08-31 13:25:00", + "2017-08-31 13:30:00", + "2017-08-31 13:35:00", + "2017-08-31 13:40:00", + "2017-08-31 13:45:00", + "2017-08-31 13:50:00", + "2017-08-31 13:55:00", + "2017-08-31 14:00:00", + "2017-08-31 14:05:00", + "2017-08-31 14:10:00", + "2017-08-31 14:15:00", + "2017-08-31 14:20:00", + "2017-08-31 14:25:00", + "2017-08-31 14:30:00", + "2017-08-31 14:35:00", + "2017-08-31 14:40:00", + "2017-08-31 14:45:00", + "2017-08-31 14:50:00", + "2017-08-31 14:55:00", + "2017-08-31 15:00:00", + "2017-08-31 15:05:00", + "2017-08-31 15:10:00", + "2017-08-31 15:15:00", + "2017-08-31 15:20:00", + "2017-08-31 15:25:00", + "2017-08-31 15:30:00", + "2017-08-31 15:35:00", + "2017-08-31 15:40:00", + "2017-08-31 15:45:00", + "2017-08-31 15:50:00", + "2017-08-31 15:55:00", + "2017-08-31 16:00:00", + "2017-08-31 16:05:00", + "2017-08-31 16:10:00", + "2017-08-31 16:15:00", + "2017-08-31 16:20:00", + "2017-08-31 16:25:00", + "2017-08-31 16:30:00", + "2017-08-31 16:35:00", + "2017-08-31 16:40:00", + "2017-08-31 16:45:00", + "2017-08-31 16:50:00", + "2017-08-31 16:55:00", + "2017-08-31 17:00:00", + "2017-08-31 17:05:00", + "2017-08-31 17:10:00", + "2017-08-31 17:15:00", + "2017-08-31 17:20:00", + "2017-08-31 17:25:00", + "2017-08-31 17:30:00", + "2017-08-31 17:35:00", + "2017-08-31 17:40:00", + "2017-08-31 17:45:00", + "2017-08-31 17:50:00", + "2017-08-31 17:55:00", + "2017-08-31 18:00:00", + "2017-08-31 18:05:00", + "2017-08-31 18:10:00", + "2017-08-31 18:15:00", + "2017-08-31 18:20:00", + "2017-08-31 18:25:00", + "2017-08-31 18:30:00", + "2017-08-31 18:35:00", + "2017-08-31 18:40:00", + "2017-08-31 18:45:00", + "2017-08-31 18:50:00", + "2017-08-31 18:55:00", + "2017-08-31 19:00:00", + "2017-08-31 19:05:00", + "2017-08-31 19:10:00", + "2017-08-31 19:15:00", + "2017-08-31 19:20:00", + "2017-08-31 19:25:00", + "2017-08-31 19:30:00", + "2017-08-31 19:35:00", + "2017-08-31 19:40:00", + "2017-08-31 19:45:00", + "2017-08-31 19:50:00", + "2017-08-31 19:55:00", + "2017-08-31 20:00:00", + "2017-08-31 20:05:00", + "2017-08-31 20:10:00", + "2017-08-31 20:15:00", + "2017-08-31 20:20:00", + "2017-08-31 20:25:00", + "2017-08-31 20:30:00", + "2017-08-31 20:35:00", + "2017-08-31 20:40:00", + "2017-08-31 20:45:00", + "2017-08-31 20:50:00", + "2017-08-31 20:55:00", + "2017-08-31 21:00:00", + "2017-08-31 21:05:00", + "2017-08-31 21:10:00", + "2017-08-31 21:15:00", + "2017-08-31 21:20:00", + "2017-08-31 21:25:00", + "2017-08-31 21:30:00", + "2017-08-31 21:35:00", + "2017-08-31 21:40:00", + "2017-08-31 21:45:00", + "2017-08-31 21:50:00", + "2017-08-31 21:55:00", + "2017-08-31 22:00:00", + "2017-08-31 22:05:00", + "2017-08-31 22:10:00", + "2017-08-31 22:15:00", + "2017-08-31 22:20:00", + "2017-08-31 22:25:00", + "2017-08-31 22:30:00", + "2017-08-31 22:35:00", + "2017-08-31 22:40:00", + "2017-08-31 22:45:00", + "2017-08-31 22:50:00", + "2017-08-31 22:55:00", + "2017-08-31 23:00:00", + "2017-08-31 23:05:00", + "2017-08-31 23:10:00", + "2017-08-31 23:15:00", + "2017-08-31 23:20:00", + "2017-08-31 23:25:00", + "2017-08-31 23:30:00", + "2017-08-31 23:35:00", + "2017-08-31 23:40:00", + "2017-08-31 23:45:00", + "2017-08-31 23:50:00", + "2017-08-31 23:55:00", + "2017-09-01 00:00:00", + "2017-09-01 00:05:00", + "2017-09-01 00:10:00", + "2017-09-01 00:15:00", + "2017-09-01 00:20:00", + "2017-09-01 00:25:00", + "2017-09-01 00:30:00", + "2017-09-01 00:35:00", + "2017-09-01 00:40:00", + "2017-09-01 00:45:00", + "2017-09-01 00:50:00", + "2017-09-01 00:55:00", + "2017-09-01 01:00:00", + "2017-09-01 01:05:00", + "2017-09-01 01:10:00", + "2017-09-01 01:15:00", + "2017-09-01 01:20:00", + "2017-09-01 01:25:00", + "2017-09-01 01:35:00", + "2017-09-01 01:40:00", + "2017-09-01 01:45:00", + "2017-09-01 01:55:00", + "2017-09-01 02:00:00", + "2017-09-01 02:10:00", + "2017-09-01 02:15:00", + "2017-09-01 02:20:00", + "2017-09-01 02:25:00", + "2017-09-01 02:30:00", + "2017-09-01 02:40:00", + "2017-09-01 02:45:00", + "2017-09-01 02:50:00", + "2017-09-01 02:55:00", + "2017-09-01 03:00:00", + "2017-09-01 03:10:00", + "2017-09-01 03:25:00", + "2017-09-01 03:30:00", + "2017-09-01 03:35:00", + "2017-09-01 03:40:00", + "2017-09-01 03:45:00", + "2017-09-01 04:00:00", + "2017-09-01 04:05:00", + "2017-09-01 04:20:00", + "2017-09-01 04:40:00", + "2017-09-01 04:45:00", + "2017-09-01 04:55:00", + "2017-09-01 05:00:00", + "2017-09-01 05:10:00", + "2017-09-01 05:15:00", + "2017-09-01 05:25:00", + "2017-09-01 05:30:00", + "2017-09-01 05:35:00", + "2017-09-01 05:40:00", + "2017-09-01 05:45:00", + "2017-09-01 05:50:00", + "2017-09-01 05:55:00", + "2017-09-01 06:00:00", + "2017-09-01 06:05:00", + "2017-09-01 06:10:00", + "2017-09-01 06:15:00", + "2017-09-01 06:25:00", + "2017-09-01 06:30:00", + "2017-09-01 06:35:00", + "2017-09-01 06:40:00", + "2017-09-01 06:45:00", + "2017-09-01 06:50:00", + "2017-09-01 06:55:00", + "2017-09-01 07:00:00", + "2017-09-01 07:05:00", + "2017-09-01 07:10:00", + "2017-09-01 07:15:00", + "2017-09-01 07:20:00", + "2017-09-01 07:25:00", + "2017-09-01 07:30:00", + "2017-09-01 07:35:00", + "2017-09-01 07:40:00", + "2017-09-01 07:45:00", + "2017-09-01 07:50:00", + "2017-09-01 07:55:00", + "2017-09-01 08:00:00", + "2017-09-01 08:05:00", + "2017-09-01 08:10:00", + "2017-09-01 08:15:00", + "2017-09-01 08:20:00", + "2017-09-01 08:25:00", + "2017-09-01 08:30:00", + "2017-09-01 08:35:00", + "2017-09-01 08:40:00", + "2017-09-01 08:45:00", + "2017-09-01 08:50:00", + "2017-09-01 08:55:00", + "2017-09-01 09:00:00", + "2017-09-01 09:05:00", + "2017-09-01 09:10:00", + "2017-09-01 09:15:00", + "2017-09-01 09:20:00", + "2017-09-01 09:25:00", + "2017-09-01 09:30:00", + "2017-09-01 09:35:00", + "2017-09-01 09:40:00", + "2017-09-01 09:45:00", + "2017-09-01 09:50:00", + "2017-09-01 09:55:00", + "2017-09-01 10:00:00", + "2017-09-01 10:05:00", + "2017-09-01 10:10:00", + "2017-09-01 10:15:00", + "2017-09-01 10:20:00", + "2017-09-01 10:25:00", + "2017-09-01 10:30:00", + "2017-09-01 10:35:00", + "2017-09-01 10:40:00", + "2017-09-01 10:45:00", + "2017-09-01 10:50:00", + "2017-09-01 10:55:00", + "2017-09-01 11:00:00", + "2017-09-01 11:05:00", + "2017-09-01 11:10:00", + "2017-09-01 11:15:00", + "2017-09-01 11:20:00", + "2017-09-01 11:25:00", + "2017-09-01 11:30:00", + "2017-09-01 11:35:00", + "2017-09-01 11:40:00", + "2017-09-01 11:45:00", + "2017-09-01 11:50:00", + "2017-09-01 11:55:00", + "2017-09-01 12:00:00", + "2017-09-01 12:05:00", + "2017-09-01 12:10:00", + "2017-09-01 12:15:00", + "2017-09-01 12:20:00", + "2017-09-01 12:25:00", + "2017-09-01 12:30:00", + "2017-09-01 12:35:00", + "2017-09-01 12:40:00", + "2017-09-01 12:45:00", + "2017-09-01 12:50:00", + "2017-09-01 12:55:00", + "2017-09-01 13:00:00", + "2017-09-01 13:05:00", + "2017-09-01 13:10:00", + "2017-09-01 13:15:00", + "2017-09-01 13:20:00", + "2017-09-01 13:25:00", + "2017-09-01 13:30:00", + "2017-09-01 13:35:00", + "2017-09-01 13:40:00", + "2017-09-01 13:45:00", + "2017-09-01 13:50:00", + "2017-09-01 13:55:00", + "2017-09-01 14:00:00", + "2017-09-01 14:05:00", + "2017-09-01 14:10:00", + "2017-09-01 14:15:00", + "2017-09-01 14:20:00", + "2017-09-01 14:25:00", + "2017-09-01 14:30:00", + "2017-09-01 14:35:00", + "2017-09-01 14:40:00", + "2017-09-01 14:45:00", + "2017-09-01 14:50:00", + "2017-09-01 14:55:00", + "2017-09-01 15:00:00", + "2017-09-01 15:05:00", + "2017-09-01 15:10:00", + "2017-09-01 15:15:00", + "2017-09-01 15:20:00", + "2017-09-01 15:25:00", + "2017-09-01 15:30:00", + "2017-09-01 15:35:00", + "2017-09-01 15:40:00", + "2017-09-01 15:45:00", + "2017-09-01 15:50:00", + "2017-09-01 15:55:00", + "2017-09-01 16:00:00", + "2017-09-01 16:05:00", + "2017-09-01 16:10:00", + "2017-09-01 16:15:00", + "2017-09-01 16:20:00", + "2017-09-01 16:25:00", + "2017-09-01 16:30:00", + "2017-09-01 16:35:00", + "2017-09-01 16:40:00", + "2017-09-01 16:45:00", + "2017-09-01 16:50:00", + "2017-09-01 16:55:00", + "2017-09-01 17:00:00", + "2017-09-01 17:05:00", + "2017-09-01 17:10:00", + "2017-09-01 17:15:00", + "2017-09-01 17:20:00", + "2017-09-01 17:25:00", + "2017-09-01 17:30:00", + "2017-09-01 17:35:00", + "2017-09-01 17:40:00", + "2017-09-01 17:45:00", + "2017-09-01 17:50:00", + "2017-09-01 17:55:00", + "2017-09-01 18:00:00", + "2017-09-01 18:05:00", + "2017-09-01 18:10:00", + "2017-09-01 18:15:00", + "2017-09-01 18:20:00", + "2017-09-01 18:25:00", + "2017-09-01 18:30:00", + "2017-09-01 18:35:00", + "2017-09-01 18:40:00", + "2017-09-01 18:45:00", + "2017-09-01 18:50:00", + "2017-09-01 18:55:00", + "2017-09-01 19:00:00", + "2017-09-01 19:05:00", + "2017-09-01 19:10:00", + "2017-09-01 19:15:00", + "2017-09-01 19:20:00", + "2017-09-01 19:25:00", + "2017-09-01 19:30:00", + "2017-09-01 19:35:00", + "2017-09-01 19:40:00", + "2017-09-01 19:45:00", + "2017-09-01 19:50:00", + "2017-09-01 19:55:00", + "2017-09-01 20:00:00", + "2017-09-01 20:05:00", + "2017-09-01 20:10:00", + "2017-09-01 20:15:00", + "2017-09-01 20:20:00", + "2017-09-01 20:25:00", + "2017-09-01 20:30:00", + "2017-09-01 20:35:00", + "2017-09-01 20:40:00", + "2017-09-01 20:45:00", + "2017-09-01 20:50:00", + "2017-09-01 20:55:00", + "2017-09-01 21:00:00", + "2017-09-01 21:05:00", + "2017-09-01 21:10:00", + "2017-09-01 21:15:00", + "2017-09-01 21:20:00", + "2017-09-01 21:25:00", + "2017-09-01 21:30:00", + "2017-09-01 21:35:00", + "2017-09-01 21:40:00", + "2017-09-01 21:45:00", + "2017-09-01 21:50:00", + "2017-09-01 21:55:00", + "2017-09-01 22:00:00", + "2017-09-01 22:05:00", + "2017-09-01 22:10:00", + "2017-09-01 22:15:00", + "2017-09-01 22:20:00", + "2017-09-01 22:25:00", + "2017-09-01 22:30:00", + "2017-09-01 22:35:00", + "2017-09-01 22:40:00", + "2017-09-01 22:45:00", + "2017-09-01 22:50:00", + "2017-09-01 22:55:00", + "2017-09-01 23:00:00", + "2017-09-01 23:05:00", + "2017-09-01 23:10:00", + "2017-09-01 23:15:00", + "2017-09-01 23:20:00", + "2017-09-01 23:25:00", + "2017-09-01 23:30:00", + "2017-09-01 23:35:00", + "2017-09-01 23:45:00", + "2017-09-01 23:50:00", + "2017-09-01 23:55:00" + ], + "y": [ + 6, + 4, + 4, + 10, + 5, + 2, + 4, + 4, + 4, + 1, + 4, + 3, + 2, + 1, + 3, + 3, + 2, + 3, + 1, + 1, + 2, + 2, + 2, + 1, + 1, + 1, + 3, + 2, + 1, + 2, + 1, + 2, + 3, + 2, + 3, + 3, + 6, + 3, + 2, + 2, + 2, + 4, + 2, + 1, + 1, + 3, + 3, + 1, + 3, + 2, + 1, + 2, + 2, + 2, + 3, + 1, + 7, + 6, + 5, + 4, + 4, + 6, + 2, + 6, + 4, + 3, + 2, + 6, + 8, + 7, + 3, + 6, + 5, + 6, + 7, + 6, + 7, + 11, + 4, + 9, + 10, + 10, + 8, + 6, + 7, + 6, + 8, + 13, + 11, + 12, + 11, + 10, + 14, + 14, + 16, + 18, + 14, + 10, + 12, + 13, + 20, + 20, + 25, + 23, + 17, + 19, + 17, + 18, + 15, + 17, + 21, + 16, + 17, + 14, + 28, + 21, + 19, + 16, + 20, + 23, + 16, + 18, + 10, + 25, + 15, + 20, + 29, + 16, + 11, + 12, + 17, + 11, + 22, + 14, + 14, + 13, + 9, + 14, + 15, + 12, + 18, + 13, + 11, + 15, + 11, + 21, + 15, + 11, + 12, + 6, + 17, + 13, + 21, + 18, + 16, + 13, + 12, + 19, + 13, + 19, + 17, + 22, + 19, + 19, + 19, + 8, + 19, + 13, + 16, + 25, + 15, + 17, + 18, + 13, + 13, + 17, + 15, + 11, + 16, + 10, + 12, + 13, + 9, + 14, + 16, + 16, + 13, + 9, + 23, + 16, + 14, + 12, + 8, + 23, + 14, + 18, + 6, + 10, + 9, + 10, + 9, + 7, + 7, + 5, + 4, + 12, + 11, + 6, + 8, + 7, + 5, + 10, + 5, + 10, + 8, + 8, + 4, + 8, + 10, + 3, + 4, + 2, + 4, + 5, + 8, + 3, + 4, + 4, + 9, + 9, + 1, + 5, + 1, + 9, + 5, + 5, + 4, + 9, + 7, + 4, + 6, + 9, + 5, + 4, + 5, + 5, + 12, + 4, + 3, + 3, + 4, + 7, + 9, + 4, + 4, + 8, + 3, + 9, + 4, + 1, + 7, + 7, + 6, + 5, + 5, + 4, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + } + ], + "layout": { + "title": "Visits from Russia" + } + }, + "text/html": [ + "
" + ], + "text/vnd.plotly.v1+html": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " countIf(Date = '2017-09-01') as today_visits,\n", + " countIf(Date = toDate('2017-09-01') - 1) as yesterday_visits,\n", + " countIf(Date = toDate('2017-09-01') - 7) as prev_week_visits,\n", + " toStartOfFiveMinute(DateTime) as date\n", + " FROM visits_all\n", + " WHERE RegionCountry = 'Russia'\n", + " AND Date IN ('2017-09-01', toDate('2017-09-01') - 1, toDate('2017-09-01') - 7)\n", + " GROUP BY date\n", + " ORDER BY date\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "plotly_line_df(get_clickhouse_df(q).set_index('date'), title = 'Visits from Russia')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Функции по работе со строками и URL" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
visitsReferer
0270341NaN
1215959https://google.ru/
232354https://google.com.ua/
316399https://metrika.yandex.ru/list
415161https://yandex.ru/support/
515109https://google.by/
613561https://google.com/
710407https://metrika.yandex.ru/calls/
87482https://yandex.ru/support/metrika/reports/add-...
95973https://yandex.ru/support/direct/statistics/me...
\n", + "
" + ], + "text/plain": [ + " visits Referer\n", + "0 270341 NaN\n", + "1 215959 https://google.ru/\n", + "2 32354 https://google.com.ua/\n", + "3 16399 https://metrika.yandex.ru/list\n", + "4 15161 https://yandex.ru/support/\n", + "5 15109 https://google.by/\n", + "6 13561 https://google.com/\n", + "7 10407 https://metrika.yandex.ru/calls/\n", + "8 7482 https://yandex.ru/support/metrika/reports/add-...\n", + "9 5973 https://yandex.ru/support/direct/statistics/me..." + ] + }, + "execution_count": 49, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as visits,\n", + " Referer\n", + " FROM visits_all\n", + " GROUP BY Referer\n", + " ORDER BY visits DESC\n", + " LIMIT 10\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
visitsReferer
0270341NaN
1215959https://google.ru/
232354https://google.com.ua/
315109https://google.by/
413561https://google.com/
54046https://google.kz/
62935https://away.vk.com/away.php
71661http://marketing-wiki.ru/wiki/Разметка_ссылок_...
81264https://google.ru
91119https://vk.com/away.php
\n", + "
" + ], + "text/plain": [ + " visits Referer\n", + "0 270341 NaN\n", + "1 215959 https://google.ru/\n", + "2 32354 https://google.com.ua/\n", + "3 15109 https://google.by/\n", + "4 13561 https://google.com/\n", + "5 4046 https://google.kz/\n", + "6 2935 https://away.vk.com/away.php\n", + "7 1661 http://marketing-wiki.ru/wiki/Разметка_ссылок_...\n", + "8 1264 https://google.ru\n", + "9 1119 https://vk.com/away.php" + ] + }, + "execution_count": 50, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as visits,\n", + " Referer\n", + " FROM visits_all\n", + " WHERE Referer NOT LIKE '%yandex.%'\n", + " GROUP BY Referer\n", + " ORDER BY visits DESC\n", + " LIMIT 10\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
visitsReferer
0215959https://google.ru/
132354https://google.com.ua/
213561https://google.com/
31264https://google.ru
41008http://google.ru/
5265https://google.com.tr/
6215https://google.com.ua
7124https://google.com
8105https://google.com.ph/
998https://google.com.vn/
\n", + "
" + ], + "text/plain": [ + " visits Referer\n", + "0 215959 https://google.ru/\n", + "1 32354 https://google.com.ua/\n", + "2 13561 https://google.com/\n", + "3 1264 https://google.ru\n", + "4 1008 http://google.ru/\n", + "5 265 https://google.com.tr/\n", + "6 215 https://google.com.ua\n", + "7 124 https://google.com\n", + "8 105 https://google.com.ph/\n", + "9 98 https://google.com.vn/" + ] + }, + "execution_count": 60, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = r'''\n", + " SELECT\n", + " count() as visits,\n", + " Referer\n", + " FROM visits_all\n", + " WHERE match(Referer, 'https?://google.(ru|com)')\n", + " GROUP BY Referer\n", + " ORDER BY visits DESC\n", + " LIMIT 10\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
visitsRefererRefererDomainRefererSignSubdomain
0270341NaNNaNNaN
1215959https://google.ru/google.rugoogle.ru
232354https://google.com.ua/google.com.uagoogle.com.ua
315109https://google.by/google.bygoogle.by
413561https://google.com/google.comgoogle.com
54046https://google.kz/google.kzgoogle.kz
62935https://away.vk.com/away.phpaway.vk.comvk.com
71661http://marketing-wiki.ru/wiki/Разметка_ссылок_...marketing-wiki.rumarketing-wiki.ru
81264https://google.rugoogle.rugoogle.ru
91119https://vk.com/away.phpvk.comvk.com
\n", + "
" + ], + "text/plain": [ + " visits Referer \\\n", + "0 270341 NaN \n", + "1 215959 https://google.ru/ \n", + "2 32354 https://google.com.ua/ \n", + "3 15109 https://google.by/ \n", + "4 13561 https://google.com/ \n", + "5 4046 https://google.kz/ \n", + "6 2935 https://away.vk.com/away.php \n", + "7 1661 http://marketing-wiki.ru/wiki/Разметка_ссылок_... \n", + "8 1264 https://google.ru \n", + "9 1119 https://vk.com/away.php \n", + "\n", + " RefererDomain RefererSignSubdomain \n", + "0 NaN NaN \n", + "1 google.ru google.ru \n", + "2 google.com.ua google.com.ua \n", + "3 google.by google.by \n", + "4 google.com google.com \n", + "5 google.kz google.kz \n", + "6 away.vk.com vk.com \n", + "7 marketing-wiki.ru marketing-wiki.ru \n", + "8 google.ru google.ru \n", + "9 vk.com vk.com " + ] + }, + "execution_count": 51, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as visits,\n", + " Referer,\n", + " domain(Referer) as RefererDomain,\n", + " cutToFirstSignificantSubdomain(Referer) as RefererSignSubdomain\n", + " FROM visits_all\n", + " WHERE Referer NOT LIKE '%yandex.%'\n", + " GROUP BY Referer\n", + " ORDER BY visits DESC\n", + " LIMIT 10\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
visitsReferer
027http://go.mail.ru/search?fm=1&q=как дать досту...
11http://go.mail.ru/search?fr=ffxtn107&gp=802821...
21http://go.mail.ru/search?fr=ffvbm1.0.0.51&fr2=...
31http://go.mail.ru/search?fr=chxtn12.0.12&q=уст...
41http://go.mail.ru/search?q=что это за адрес ht...
51http://go.mail.ru/search?fr=chvbm7.0.30&fr2=qu...
\n", + "
" + ], + "text/plain": [ + " visits Referer\n", + "0 27 http://go.mail.ru/search?fm=1&q=как дать досту...\n", + "1 1 http://go.mail.ru/search?fr=ffxtn107&gp=802821...\n", + "2 1 http://go.mail.ru/search?fr=ffvbm1.0.0.51&fr2=...\n", + "3 1 http://go.mail.ru/search?fr=chxtn12.0.12&q=уст...\n", + "4 1 http://go.mail.ru/search?q=что это за адрес ht...\n", + "5 1 http://go.mail.ru/search?fr=chvbm7.0.30&fr2=qu..." + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as visits,\n", + " Referer\n", + " FROM visits_all\n", + " WHERE Referer LIKE '%mail.ru/search%'\n", + " GROUP BY Referer\n", + " ORDER BY visits DESC\n", + " LIMIT 10\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
visitsquery
027как дать доступ в яндекс метрику
11https:%2F%2Fmetrika.yandex.ru%2Fdashboard%3Fid...
21что это за адрес https mc yandex ru metrika wa...
31яндекс метрик%5C
41установить на сайт счетчик яндекс
51яндексметрика
\n", + "
" + ], + "text/plain": [ + " visits query\n", + "0 27 как дать доступ в яндекс метрику\n", + "1 1 https:%2F%2Fmetrika.yandex.ru%2Fdashboard%3Fid...\n", + "2 1 что это за адрес https mc yandex ru metrika wa...\n", + "3 1 яндекс метрик%5C\n", + "4 1 установить на сайт счетчик яндекс\n", + "5 1 яндексметрика" + ] + }, + "execution_count": 53, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as visits,\n", + " extractURLParameter(Referer, 'q') as query\n", + " FROM visits_all\n", + " WHERE Referer LIKE '%mail.ru/search%'\n", + " GROUP BY query\n", + " ORDER BY visits DESC\n", + " LIMIT 10\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
visitsStartURLpath
0133394https://yandex.ru/support/metrika//support/metrika/
191121https://yandex.ru/support/metrika/reports/add-.../support/metrika/reports/add-goals.xml
266650https://yandex.ru/support/metrika/general/acce.../support/metrika/general/access.xml
355021https://yandex.ru/support/metrika/objects/reac.../support/metrika/objects/reachgoal.xml
451122https://yandex.ru/support/metrika/quick-start.xml/support/metrika/quick-start.xml
548977https://yandex.ru/support/metrika/general/glos.../support/metrika/general/glossary.xml
645955https://yandex.ru/support/metrika/troubleshoot.../support/metrika/troubleshooting.xml
744190https://yandex.ru/support/metrika/general/goal.../support/metrika/general/goals.xml
834018https://yandex.ru/support/metrika/data/e-comme.../support/metrika/data/e-commerce.xml
932447https://yandex.ru/support/metrika/general/targ.../support/metrika/general/target-call.xml
\n", + "
" + ], + "text/plain": [ + " visits StartURL \\\n", + "0 133394 https://yandex.ru/support/metrika/ \n", + "1 91121 https://yandex.ru/support/metrika/reports/add-... \n", + "2 66650 https://yandex.ru/support/metrika/general/acce... \n", + "3 55021 https://yandex.ru/support/metrika/objects/reac... \n", + "4 51122 https://yandex.ru/support/metrika/quick-start.xml \n", + "5 48977 https://yandex.ru/support/metrika/general/glos... \n", + "6 45955 https://yandex.ru/support/metrika/troubleshoot... \n", + "7 44190 https://yandex.ru/support/metrika/general/goal... \n", + "8 34018 https://yandex.ru/support/metrika/data/e-comme... \n", + "9 32447 https://yandex.ru/support/metrika/general/targ... \n", + "\n", + " path \n", + "0 /support/metrika/ \n", + "1 /support/metrika/reports/add-goals.xml \n", + "2 /support/metrika/general/access.xml \n", + "3 /support/metrika/objects/reachgoal.xml \n", + "4 /support/metrika/quick-start.xml \n", + "5 /support/metrika/general/glossary.xml \n", + "6 /support/metrika/troubleshooting.xml \n", + "7 /support/metrika/general/goals.xml \n", + "8 /support/metrika/data/e-commerce.xml \n", + "9 /support/metrika/general/target-call.xml " + ] + }, + "execution_count": 54, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT\n", + " count() as visits,\n", + " StartURL,\n", + " path(StartURL) as path\n", + " FROM visits_all\n", + " GROUP BY StartURL\n", + " ORDER BY visits DESC\n", + " LIMIT 10\n", + " FORMAT TabSeparatedWithNames\n", + "'''\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/materials/2018-05-07-retentions.ipynb b/materials/2018-05-07-retentions.ipynb new file mode 100755 index 0000000..9cda165 --- /dev/null +++ b/materials/2018-05-07-retentions.ipynb @@ -0,0 +1,1162 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Retentions\n", + "\n", + "Давайте посчитаем классический retention по недельным когортам." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "HOST = 'http://localhost:8123'\n", + "import requests\n", + "import pandas as pd\n", + "import io\n", + "import datetime\n", + "import seaborn as sns\n", + "\n", + "pd.set_option('display.max_columns', 500)\n", + "pd.set_option('display.max_colwidth', 150)\n", + "\n", + "def get_clickhouse_data(query, host = HOST, connection_timeout = 1500):\n", + " query = query \n", + " r = requests.post(host, params = {'query': query}, timeout = connection_timeout)\n", + " if r.status_code == 200:\n", + " return r.text\n", + " else:\n", + " raise ValueError(r.text)\n", + " \n", + "def get_clickhouse_df(query, host = HOST, connection_timeout = 1500):\n", + " data = get_clickhouse_data(query, host, connection_timeout) \n", + " df = pd.read_csv(io.StringIO(data), sep = '\\t')\n", + " return df" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/vnd.plotly.v1+html": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from plotly import __version__\n", + "from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot\n", + "from plotly import graph_objs as go\n", + "import requests\n", + "import pandas as pd\n", + "\n", + "init_notebook_mode(connected = True)\n", + "\n", + "def plotly_df(df, title = ''):\n", + " data = []\n", + " \n", + " for column in df.columns:\n", + " trace = go.Scatter(\n", + " x = df.index,\n", + " y = df[column],\n", + " mode = 'lines',\n", + " name = column\n", + " )\n", + " data.append(trace)\n", + " \n", + " layout = dict(title = title)\n", + " fig = dict(data = data, layout = layout)\n", + " \n", + " iplot(fig, show_link = False)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "def highlight_vals(val):\n", + " if (val is None) or (val == ''):\n", + " return ''\n", + " p = 0.5\n", + " if val > 90:\n", + " return 'background-color: rgba(229, 0, 20, %f)' % p\n", + " if val > 80:\n", + " return 'background-color: rgba(231, 25, 43, %f)' % p\n", + " if val > 70:\n", + " return 'background-color: rgba(234, 51, 67, %f)' % p\n", + " if val > 60:\n", + " return 'background-color: rgba(236, 76, 90, %f)' % p\n", + " if val > 50:\n", + " return 'background-color: rgba(239, 102, 114, %f)' % p\n", + " if val > 40:\n", + " return 'background-color: rgba(242, 137, 127, %f)' % p\n", + " if val > 30:\n", + " return 'background-color: rgba(244, 153, 161, %f)' % p\n", + " if val > 20:\n", + " return 'background-color: rgba(247, 178, 184, %f)' % p\n", + " if val > 10:\n", + " return 'background-color: rgba(249, 204, 208, %f)' % p\n", + " return 'background-color: rgba(252, 229, 231, %f)' % p" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "start_date = datetime.datetime(2017, 8, 28)\n", + "end_date = datetime.datetime(2017, 10, 1)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "''" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = 'DROP TABLE IF EXISTS retention_users'\n", + "get_clickhouse_data(q)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Для начала выгрузим в отдельную таблицу для каждого пользователя, в какие недели он появлялся на сервисе." + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "''" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " CREATE TABLE retention_users ENGINE = Log AS\n", + " SELECT DISTINCT \n", + " ClientID as client_id, \n", + " toMonday(Date) as date\n", + " FROM visits_all\n", + " WHERE (client_id != 0)\n", + "'''.format(\n", + " start_date = start_date.strftime('%Y-%m-%d'),\n", + " end_date = end_date.strftime('%Y-%m-%d')\n", + ")\n", + "\n", + "get_clickhouse_data(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
visitsusers
0873866620334
\n", + "
" + ], + "text/plain": [ + " visits users\n", + "0 873866 620334" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT \n", + " count() as visits, \n", + " uniq(client_id) as users\n", + " FROM retention_users \n", + " FORMAT TabSeparatedWithNames'''\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
client_idmin_datemax_datedate
015059212403785442472017-09-182017-09-182017-09-18
115036376635878847412017-09-252017-09-252017-09-25
214982101965633068902017-09-182017-09-182017-09-18
315015916972866441092017-09-042017-09-112017-09-04
415015916972866441092017-09-042017-09-112017-09-11
515012339982393057672017-09-252017-09-252017-09-25
614725736058448996772017-09-042017-09-042017-09-04
714921770105745998682017-09-182017-09-182017-09-18
815052146174143010782017-09-182017-09-182017-09-18
914708763052748079572017-09-112017-09-112017-09-11
\n", + "
" + ], + "text/plain": [ + " client_id min_date max_date date\n", + "0 1505921240378544247 2017-09-18 2017-09-18 2017-09-18\n", + "1 1503637663587884741 2017-09-25 2017-09-25 2017-09-25\n", + "2 1498210196563306890 2017-09-18 2017-09-18 2017-09-18\n", + "3 1501591697286644109 2017-09-04 2017-09-11 2017-09-04\n", + "4 1501591697286644109 2017-09-04 2017-09-11 2017-09-11\n", + "5 1501233998239305767 2017-09-25 2017-09-25 2017-09-25\n", + "6 1472573605844899677 2017-09-04 2017-09-04 2017-09-04\n", + "7 1492177010574599868 2017-09-18 2017-09-18 2017-09-18\n", + "8 1505214617414301078 2017-09-18 2017-09-18 2017-09-18\n", + "9 1470876305274807957 2017-09-11 2017-09-11 2017-09-11" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "q = '''\n", + " SELECT \n", + " client_id,\n", + " min_date, \n", + " max_date,\n", + " date\n", + " FROM\n", + " (\n", + " SELECT\n", + " client_id,\n", + " min(date) as min_date,\n", + " max(date) as max_date\n", + " FROM retention_users\n", + " GROUP BY client_id\n", + " HAVING (min_date <= '{end_date}') AND (min_date >= '{start_date}')\n", + " )\n", + " ALL INNER JOIN\n", + " (\n", + " SELECT \n", + " client_id,\n", + " date\n", + " FROM retention_users\n", + " ) \n", + " USING client_id\n", + " LIMIT 10\n", + " FORMAT TabSeparatedWithNames\n", + "'''.format(\n", + " start_date = start_date.strftime('%Y-%m-%d'),\n", + " end_date = end_date.strftime('%Y-%m-%d')\n", + ")\n", + "\n", + "get_clickhouse_df(q)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Классический retention" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "\n", + "\n", + "q = '''\n", + "SELECT \n", + " uniq(client_id) as clients,\n", + " min_date, \n", + " (date - min_date)/7 as week_num\n", + "FROM\n", + " (\n", + " SELECT\n", + " client_id,\n", + " min(date) as min_date,\n", + " max(date) as max_date\n", + " FROM retention_users\n", + " GROUP BY client_id\n", + " HAVING (min_date <= '{end_date}') AND (min_date >= '{start_date}')\n", + " )\n", + " ALL INNER JOIN\n", + " (\n", + " SELECT \n", + " client_id,\n", + " date\n", + " FROM retention_users\n", + " ) \n", + " USING client_id\n", + "GROUP BY\n", + " week_num,\n", + " min_date\n", + "FORMAT TabSeparatedWithNames\n", + "'''.format(\n", + " start_date = start_date.strftime('%Y-%m-%d'),\n", + " end_date = end_date.strftime('%Y-%m-%d')\n", + ")\n", + "\n", + "raw_ret_df = get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
clientsmin_dateweek_num
089532017-09-110
12052017-08-284
22812017-08-283
33382017-08-282
45872017-08-281
\n", + "
" + ], + "text/plain": [ + " clients min_date week_num\n", + "0 8953 2017-09-11 0\n", + "1 205 2017-08-28 4\n", + "2 281 2017-08-28 3\n", + "3 338 2017-08-28 2\n", + "4 587 2017-08-28 1" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "raw_ret_df.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "ret_df = raw_ret_df.pivot_table(\n", + " index = 'min_date', \n", + " values = 'clients', \n", + " columns = 'week_num').fillna(0).T" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "ret_df_norm = ret_df.apply(lambda x: 100*x/ret_df.loc[0], axis = 1).applymap(lambda x: x if x!=0 else None)" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "data": [ + { + "mode": "lines", + "name": "2017-08-28", + "type": "scatter", + "x": [ + 0, + 1, + 2, + 3, + 4 + ], + "y": [ + 100, + 7.0535928863254025, + 4.061523672194184, + 3.376592165344869, + 2.463350156212449 + ] + }, + { + "mode": "lines", + "name": "2017-09-04", + "type": "scatter", + "x": [ + 0, + 1, + 2, + 3, + 4 + ], + "y": [ + 100, + 7.290651067056657, + 4.008233127505146, + 2.968259126855162, + null + ] + }, + { + "mode": "lines", + "name": "2017-09-11", + "type": "scatter", + "x": [ + 0, + 1, + 2, + 3, + 4 + ], + "y": [ + 100, + 7.818608287724785, + 3.953981905506534, + null, + null + ] + }, + { + "mode": "lines", + "name": "2017-09-18", + "type": "scatter", + "x": [ + 0, + 1, + 2, + 3, + 4 + ], + "y": [ + 100, + 6.421771151428058, + null, + null, + null + ] + }, + { + "mode": "lines", + "name": "2017-09-25", + "type": "scatter", + "x": [ + 0, + 1, + 2, + 3, + 4 + ], + "y": [ + 100, + null, + null, + null, + null + ] + } + ], + "layout": { + "title": "" + } + }, + "text/html": [ + "
" + ], + "text/vnd.plotly.v1+html": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "plotly_df(ret_df_norm)" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
week_num01234
min_date
2017-08-281007.053594.061523.376592.46335
2017-09-041007.290654.008232.96826
2017-09-111007.818613.95398
2017-09-181006.42177
2017-09-25100
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ret_df_norm.T.fillna('').style.applymap(highlight_vals)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Rolling retention" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "q = '''\n", + "SELECT\n", + " uniq(client_id) as clients,\n", + " min_date,\n", + " week_num\n", + "FROM\n", + " (SELECT \n", + " client_id,\n", + " min_date, \n", + " arrayJoin(range(toUInt64((max_date - min_date)/7) + 1)) as week_num\n", + " FROM\n", + " (\n", + " SELECT\n", + " client_id,\n", + " min(date) as min_date,\n", + " max(date) as max_date\n", + " FROM retention_users\n", + " GROUP BY client_id\n", + " HAVING (min_date <= '{end_date}') AND (min_date >= '{start_date}')\n", + " ))\n", + "GROUP BY\n", + " min_date,\n", + " week_num\n", + "FORMAT TabSeparatedWithNames\n", + "'''.format(\n", + " start_date = start_date.strftime('%Y-%m-%d'),\n", + " end_date = end_date.strftime('%Y-%m-%d')\n", + ")\n", + "\n", + "raw_roll_ret_df = get_clickhouse_df(q)" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "roll_ret_df = raw_roll_ret_df.pivot_table(index = 'min_date', \n", + " values = 'clients', \n", + " columns = 'week_num').fillna(0).T" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "roll_ret_df_norm = roll_ret_df\\\n", + " .apply(lambda x: 100*x/roll_ret_df.loc[0], axis = 1)\\\n", + " .applymap(lambda x: x if x!=0 else None)" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "data": [ + { + "mode": "lines", + "name": "2017-08-28", + "type": "scatter", + "x": [ + 0, + 1, + 2, + 3, + 4 + ], + "y": [ + 100, + 12.797404470079307, + 7.954818553232396, + 5.191059841384282, + 2.463350156212449 + ] + }, + { + "mode": "lines", + "name": "2017-09-04", + "type": "scatter", + "x": [ + 0, + 1, + 2, + 3, + 4 + ], + "y": [ + 100, + 11.212219694507636, + 6.023182753764489, + 2.968259126855162, + null + ] + }, + { + "mode": "lines", + "name": "2017-09-11", + "type": "scatter", + "x": [ + 0, + 1, + 2, + 3, + 4 + ], + "y": [ + 100, + 10.253546297330503, + 3.953981905506534, + null, + null + ] + }, + { + "mode": "lines", + "name": "2017-09-18", + "type": "scatter", + "x": [ + 0, + 1, + 2, + 3, + 4 + ], + "y": [ + 100, + 6.421771151428058, + null, + null, + null + ] + }, + { + "mode": "lines", + "name": "2017-09-25", + "type": "scatter", + "x": [ + 0, + 1, + 2, + 3, + 4 + ], + "y": [ + 100, + null, + null, + null, + null + ] + } + ], + "layout": { + "title": "" + } + }, + "text/html": [ + "
" + ], + "text/vnd.plotly.v1+html": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "plotly_df(roll_ret_df_norm)" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
week_num01234
min_date
2017-08-2810012.79747.954825.191062.46335
2017-09-0410011.21226.023182.96826
2017-09-1110010.25353.95398
2017-09-181006.42177
2017-09-25100
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "roll_ret_df_norm.T.fillna('').style.applymap(highlight_vals)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.5.2" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}