{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "
selection = hv.streams.Selection1D(source=scatter)\n",
"\n",
"def selection_boxwhisker(index):\n",
" selection = scatter.iloc[index]\n",
" return hv.BoxWhisker(selection, 'clarity', 'price')\n",
"\n",
"scatter + hv.DynamicMap(selection_boxwhisker, streams=[selection])
\n",
"%%opts RGB [width=600 height=600]\n",
"pipe = hv.streams.Pipe(example)\n",
"tiles = gv.WMTS('https://maps.wikimedia.org/osm-intl/{Z}/{X}/{Y}@2x.png')\n",
"\n",
"def hourly_points(data):\n",
" label = '%s - %s' % (str(data.index.min()), str(data.index.max()))\n",
" return hv.Points(data, ['pickup_x', 'pickup_y'], label=label)\n",
"\n",
"points = hv.DynamicMap(hourly_points, streams=[pipe])\n",
"tiles * datashade(points)
\n",
"resampled = resample(dmap)\n",
"outliers = rolling_outlier_std(resampled)\n",
"resampled * outliers\n",
"
\n",
"%%opts Curve [width=800 height=400] (color='black' line_width=1) {+framewise} Scatter (color='red') Overlay [show_legend=False]\n",
"\n",
"example = next(trips)[['fare_amount']]\n",
"buffer = hv.streams.Buffer(example, length=1000000)\n",
"\n",
"def fare_curve(data):\n",
" return hv.Curve(data, 'tpep_pickup_datetime', 'fare_amount')\n",
"\n",
"fares = hv.DynamicMap(fare_curve, streams=[buffer])\n",
"minutely = resample(fares, rule='T', function=np.sum)\n",
"minutely * rolling_outlier_std(minutely, rolling_window=10)
\n",
"