-
Notifications
You must be signed in to change notification settings - Fork 2
/
Zeppelin-Nvd3-Demo.json
1 lines (1 loc) · 71.6 KB
/
Zeppelin-Nvd3-Demo.json
1
{"paragraphs":[{"title":"Check Versions","text":"%pyspark\n\ndef versionCheck():\n import sys\n print(\"Python: \" + sys.version.replace(\"\\n\", \" - \"))\n print(\"Spark: \" + sc.version)\n\ndef display(html, style=None):\n print(\"%html\")\n if isinstance(html, (tuple, list)):\n html = \"\".join([\"\"\"<div style=\"display:inline; margin-left:%dpx\">%s</div>\"\"\" % (el[1], el[0]) for el in html])\n if style is not None:\n html = \"<%s>%s</%s>\" % (style, html, style)\n print(html)\n\ndef getNoteId():\n return z.z.getInterpreterContext().getNoteId()\n\ndef getParagraphId():\n return z.z.getInterpreterContext().getParagraphId()\n\n\n# The variable z holds the zeppelinContext. It is essential for all Angular based interactions - so let's save it :-)\nZEPPELIN_CONTEXT = z.z\n\n# In case one overwrites z, z = recoverZeppelinContext() gets the context back\ndef recoverZeppelinContext():\n return PyZeppelinContext(ZEPPELIN_CONTEXT)\n\nversionCheck()\n","user":"anonymous","dateUpdated":"2017-03-30T11:25:41+0200","config":{"enabled":true,"title":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266840_2038843876","id":"20170312-173550_607126225","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:25:41+0200","dateFinished":"2017-03-30T11:25:41+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"focus":true,"$$hashKey":"object:16795"},{"title":"Some helpers to create data","text":"%pyspark\n\nimport numpy as np\nimport pandas as pd\nimport random\nimport time\nfrom datetime import datetime\n\npd.options.display.width=200\n\ndef randomList(count, mean, dist):\n return [ mean + (1 if random.random() > 0.5 else -1) * random.random() * dist for i in range(count)]\n\n\ndef randomNormalList(count, mean, stdev):\n return np.random.normal(mean, stdev, count).tolist()\n\n\ndef randomWalk(count=20, factor=2, offset=10):\n return np.abs(np.cumsum(np.random.uniform(-factor, factor, (count, 1)) ) + offset)\n\n\ndef lastDays(days, epoch=True, ms=True):\n now = datetime.now()\n t = int(time.mktime(now.timetuple())) - 3600 * 24 * days\n if epoch:\n factor = 1000 if ms else 1\n return [int(t + i * 3600 * 24) * factor for i in range(days)]\n else:\n return [time.strftime('%Y-%m-%d', time.localtime(int(t + i*3600*24))) for i in range(days)]\n ","user":"anonymous","dateUpdated":"2017-03-30T11:25:49+0200","config":{"enabled":true,"title":true,"results":[],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266842_2039613374","id":"20170313-121917_178507939","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:25:49+0200","dateFinished":"2017-03-30T11:25:49+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16796"},{"title":"Stock data loader","text":"%pyspark\n\n#\n# pip install yahoo-finance\n#\n\nfrom yahoo_finance import Share \n\ndef downloadHistoricalStockData(symbol, begin, end, fillMissing=True):\n data = Share(symbol).get_historical(\"%04d-%02d-%02d\" % begin, \"%04d-%02d-%02d\" % end)\n df = pd.DataFrame(data)\n\n for col in \"Adj_Close\", \"Close\", \"High\", \"Low\", \"Open\":\n df[col] = df[col].astype(float)\n df[\"Volume\"] = df[\"Volume\"].astype(int)\n df[\"Date\"] = pd.to_datetime(df[\"Date\"], infer_datetime_format=True)\n \n if fillMissing:\n return fillMissingValues(df, symbol, begin, end)\n else: \n return df\n\ndef fillMissingValues(df, symbol, begin, end):\n allDates = pd.DataFrame({\"Date\": pd.date_range(pd.datetime(*begin), pd.datetime(*end), freq='D')})\n df2 = allDates.merge(df, how=\"outer\")\n df2[\"Symbol\"] = symbol\n # for volume fill bank holidays with 0 (no trade)\n df2[\"Volume\"] = df2[\"Volume\"].fillna(0)\n # and all indicators with value of day before (no price change)\n df2 = df2.fillna(axis=0, method=\"ffill\")\n df2[\"Timestamp\"] = (df2[\"Date\"].astype(\"int64\") / 1000000).astype('int64')\n return df2.sort_values(by=[\"Timestamp\"])\n \n","user":"anonymous","dateUpdated":"2017-03-30T11:47:11+0200","config":{"enabled":true,"title":true,"results":[],"editorMode":"ace/mode/python","editorSetting":{"language":"python","editOnDblClick":false},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266843_2039228625","id":"20170319-153940_1371606880","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:47:11+0200","dateFinished":"2017-03-30T11:47:11+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16797"},{"title":"Iris data download ...","text":"%sh\ncd /tmp\nwget https://raw.github.com/pydata/pandas/master/pandas/tests/data/iris.csv","dateUpdated":"2017-03-30T11:14:26+0200","config":{"enabled":true,"title":true,"tableHide":true,"results":[],"editorMode":"ace/mode/sh","editorSetting":{"language":"sh","editOnDblClick":false},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266844_2037304880","id":"20170316-172251_1574722917","dateCreated":"2017-03-30T11:14:26+0200","status":"READY","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16798"},{"title":"... and as pandas DataFrame","text":"%pyspark\n\nimport pandas as pd\niris = pd.read_csv('/tmp/iris.csv')\n\ndef getSpecies(name):\n return iris[iris.Name==name].loc[:,iris.columns != 'Name']\n\nprint(iris.head())","user":"anonymous","dateUpdated":"2017-03-30T11:30:19+0200","config":{"enabled":true,"title":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python","editOnDblClick":false},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266845_2036920131","id":"20170316-172339_752876435","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:30:19+0200","dateFinished":"2017-03-30T11:30:19+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16799"},{"text":"%md\n## 1 Preparation\n","dateUpdated":"2017-03-30T11:58:25+0200","config":{"enabled":true,"tableHide":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/markdown","editorHide":true,"editorSetting":{"language":"markdown","editOnDblClick":true},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266846_2038074378","id":"20170313-160431_1894158266","dateCreated":"2017-03-30T11:14:26+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16800","user":"anonymous","dateFinished":"2017-03-30T11:58:25+0200","dateStarted":"2017-03-30T11:58:25+0200","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>1 Preparation</h2>\n</div>"}]}},{"title":"Initialize ZeppelinSession ...","text":"%pyspark\n\nfrom zeppelin_session import ZeppelinSession, resetZeppelinSession, LogLevel, Logger\n\nresetZeppelinSession(z.z)\n\nzs = ZeppelinSession(z.z)\n","user":"anonymous","dateUpdated":"2017-03-30T11:26:03+0200","config":{"enabled":true,"title":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266847_2037689629","id":"20170312-173616_1035870734","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:26:03+0200","dateFinished":"2017-03-30T11:26:03+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16801"},{"title":"... and start it in the next paragraph","text":"%pyspark\n\nzs.start()\n","user":"anonymous","dateUpdated":"2017-03-30T11:26:06+0200","config":{"enabled":true,"title":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266848_2023453920","id":"20170312-173708_574610088","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:26:07+0200","dateFinished":"2017-03-30T11:26:07+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16802"},{"title":"Initialize NVD3","text":"%pyspark\n\nfrom nvd3_stat import Nvd3\n\nnv = Nvd3()\nnv.reloadNVD3(\"1.8.5\")\n","user":"anonymous","dateUpdated":"2017-03-30T11:27:13+0200","config":{"enabled":true,"title":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266849_2023069171","id":"20170312-173747_1491081154","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:27:13+0200","dateFinished":"2017-03-30T11:27:13+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16803"},{"text":"%md\n\n## Limitations\n\n- ZeppelinSession is a pure frontend integration, hence a **shared notebook will not see the charts**\n- ZeppelinSession depends on the Angular scope of the notebook, after leaving and re-entering the notebook, the scope is gone and the **charts are gone**","dateUpdated":"2017-03-30T11:58:28+0200","config":{"enabled":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/markdown","editorHide":true,"colWidth":12,"editorSetting":{}},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266855_2022299673","id":"20170320-154257_1354667801","dateCreated":"2017-03-30T11:14:26+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16804","user":"anonymous","dateFinished":"2017-03-30T11:58:29+0200","dateStarted":"2017-03-30T11:58:29+0200","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>Limitations</h2>\n<ul>\n <li>ZeppelinSession is a pure frontend integration, hence a <strong>shared notebook will not see the charts</strong></li>\n <li>ZeppelinSession depends on the Angular scope of the notebook, after leaving and re-entering the notebook, the scope is gone and the <strong>charts are gone</strong></li>\n</ul>\n</div>"}]}},{"text":"%md\n## 1 Box Plot Chart\n### a) Single IQR Box Plot","user":"anonymous","dateUpdated":"2017-03-30T11:58:30+0200","config":{"enabled":true,"tableHide":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/markdown","editorHide":true,"editorSetting":{"language":"markdown","editOnDblClick":true},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266851_2023838669","id":"20170313-160339_90253745","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:58:30+0200","dateFinished":"2017-03-30T11:58:30+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16805","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>1 Box Plot Chart</h2>\n<h3>a) Single IQR Box Plot</h3>\n</div>"}]}},{"text":"%pyspark\ndf = pd.DataFrame({\"X1\":randomNormalList(50, 5, 1), \"X2\":randomNormalList(50, 3, 0.5)})\n\nbp1 = nv.boxPlotChart()\n\nconfig={\"height\": 400, \"width\":450, \"color\":nv.c10(), \"yDomain\": [0, 10], \"maxBoxWidth\":False }\n\nbp1.plot(data=df, boxStyle=\"iqr\", config=config)\n","user":"anonymous","dateUpdated":"2017-03-30T11:29:17+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python","editOnDblClick":false},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866110179_-423180781","id":"20170330-112830_2123762970","dateCreated":"2017-03-30T11:28:30+0200","dateStarted":"2017-03-30T11:29:17+0200","dateFinished":"2017-03-30T11:29:17+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16806"},{"text":"%md\n### b) Append values\n","user":"anonymous","dateUpdated":"2017-03-30T11:58:33+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"markdown","editOnDblClick":true},"editorMode":"ace/mode/markdown","editorHide":true,"tableHide":false},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866131314_-1430038004","id":"20170330-112851_1309939999","dateCreated":"2017-03-30T11:28:51+0200","dateStarted":"2017-03-30T11:58:33+0200","dateFinished":"2017-03-30T11:58:33+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16807","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h3>b) Append values</h3>\n</div>"}]}},{"text":"%pyspark\nbp1.append({\"X1\":[1,5,7,8,9,8,7], \"X2\":[0.5, 3,4,5,6,3,2]})\n","user":"anonymous","dateUpdated":"2017-03-30T11:29:20+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python"},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866130538_1378259542","id":"20170330-112850_1656618","dateCreated":"2017-03-30T11:28:50+0200","dateStarted":"2017-03-30T11:29:20+0200","dateFinished":"2017-03-30T11:29:20+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16808"},{"text":"%md\n### c) Horizontal Plots\n","user":"anonymous","dateUpdated":"2017-03-30T11:58:35+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"markdown","editOnDblClick":true},"editorMode":"ace/mode/markdown","editorHide":true,"tableHide":false},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866166290_-1588741730","id":"20170330-112926_1897081283","dateCreated":"2017-03-30T11:29:26+0200","dateStarted":"2017-03-30T11:58:35+0200","dateFinished":"2017-03-30T11:58:35+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16809","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h3>c) Horizontal Plots</h3>\n</div>"}]}},{"title":"Compare the three species (IQR box plot)","text":"%pyspark\n\ndisplay(html=[(\"Iris-setosa\", 40),(\"Iris-versicolor\", 330),(\"Iris-virginica\", 300)], style=\"h3\")\n\nbp2 = nv.boxPlotChart()\n\nconfig = {\"height\": 400, \"width\":450, \"color\":nv.c10(), \"yDomain\": [-0.5, 8.5], \"maxBoxWidth\":False}\n\nbp2.hplot([bp2.chart(getSpecies(\"Iris-setosa\"), boxStyle=\"iqr\", config=config),\n bp2.chart(getSpecies(\"Iris-versicolor\"), boxStyle=\"iqr\", config=config),\n bp2.chart(getSpecies(\"Iris-virginica\"), boxStyle=\"iqr\", config=config)])\n\n","user":"anonymous","dateUpdated":"2017-03-30T11:30:24+0200","config":{"enabled":true,"title":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python","editOnDblClick":false},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266853_2021530175","id":"20170317-150707_2126564029","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:30:24+0200","dateFinished":"2017-03-30T11:30:24+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16810"},{"title":"Compare IQR and Min-Max box plot","text":"%pyspark\n\nbp3 = nv.boxPlotChart()\n\nconfig = {\"height\": 400, \"width\":450, \"color\":nv.c10(), \"yDomain\": [-0.5, 6], \"maxBoxWidth\":False }\n\nbp3.hplot([bp3.chart(data=getSpecies(\"Iris-setosa\"), boxStyle=\"iqr\", config=config),\n bp3.chart(data=getSpecies(\"Iris-setosa\"), boxStyle=\"min-max\", config=config)])\n","user":"anonymous","dateUpdated":"2017-03-30T11:30:51+0200","config":{"enabled":true,"title":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorHide":false,"editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266854_2022684422","id":"20170313-200613_972915341","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:30:51+0200","dateFinished":"2017-03-30T11:30:51+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16811"},{"text":"%md\n\n## 2 Line Chart\n\n### a) Plot\n","user":"anonymous","dateUpdated":"2017-03-30T11:58:38+0200","config":{"enabled":true,"tableHide":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/markdown","editorHide":true,"editorSetting":{"language":"markdown","editOnDblClick":true},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266856_2020375929","id":"20170313-161407_1460612817","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:58:38+0200","dateFinished":"2017-03-30T11:58:38+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16812","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>2 Line Chart</h2>\n<h3>a) Plot</h3>\n</div>"}]}},{"text":"%pyspark\nx = np.linspace(0, 4*np.pi, 100)\n\nl_df = pd.DataFrame({\"X\":x,\n \"Sin\":np.sin(x), \n \"Cos\":np.cos(x), \n \"ArcTan\":np.arctan(x-2*np.pi)/3})\n\nprint(l_df.head())\n","user":"anonymous","dateUpdated":"2017-03-30T11:31:56+0200","config":{"enabled":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python","editOnDblClick":false},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266857_2019991180","id":"20170319-162443_1869816905","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:31:56+0200","dateFinished":"2017-03-30T11:31:56+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16813"},{"title":"Single line","text":"%pyspark\nl1 = nv.lineChart()\n\nconfig={\"height\":350, \"width\": 800, \"color\":nv.c10(), \n \"yAxis\":{\"axisLabel\":\"f(x)\", \"tickFormat\":\",.2f\"}, \n \"xAxis\":{\"axisLabel\":\"x\", \"tickFormat\":\",.2f\"}}\n \nlineAttributes={\"area\":True, \"fillOpacity\":0.2, \"style\":\"dashed\"}\n\nl1.plot(l_df, \"X\", \"Sin\", lineAttributes, config)\n","user":"anonymous","dateUpdated":"2017-03-30T11:32:23+0200","config":{"enabled":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12,"title":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266858_2021145426","id":"20170314-123444_2108268612","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:32:23+0200","dateFinished":"2017-03-30T11:32:23+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16814"},{"text":"%pyspark\nl2 = nv.lineChart()\n\ndef config(i):\n return {\"height\":300, \"width\": 400, \"color\":nv.c10()[i-1:], \n \"yAxis\":{\"axisLabel\":\"f(x)\", \"tickFormat\":\",.2f\"}, \n \"xAxis\":{\"axisLabel\":\"x\", \"tickFormat\":\",.2f\"},\n \"yDomain\":[-1.2,1.2]}\n\nlineAttributes1={\"area\":True, \"fillOpacity\":0.2, \"style\":\"dashed\"}\nlineAttributes2={\"area\":False, \"style\":\"dotted\"}\nlineAttributes3={\"area\":True, \"fillOpacity\":1.0 }\n\nl2.hplot([l2.chart(l_df, \"X\", \"Sin\", lineAttributes1, config=config(1)),\n l2.chart(l_df, \"X\", \"Cos\", lineAttributes2, config=config(2)),\n l2.chart(l_df, \"X\", \"ArcTan\", lineAttributes3, config=config(3))])","user":"anonymous","dateUpdated":"2017-03-30T11:33:00+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python"},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866373687_752610213","id":"20170330-113253_1970731421","dateCreated":"2017-03-30T11:32:53+0200","dateStarted":"2017-03-30T11:33:00+0200","dateFinished":"2017-03-30T11:33:00+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16815"},{"title":"Multiple lines","text":"%pyspark\nl3 = nv.lineChart()\n\nconfig={\"height\":500, \"width\": 1024, \"color\":nv.c20b()[10:13], \n \"yAxis\":{\"axisLabel\":\"f(x)\", \"tickFormat\":\",.2f\"}, \n \"xAxis\":{\"axisLabel\":\"x\", \"tickFormat\":\",.2f\"},\n \"focusEnable\": False, \"duration\":0}\n \nlineAttributes={\"area\":[True, False, True], \"fillOpacity\":[0.2, 0, 0.2], \"style\":[\"dashed\", \"dotted\", None]}\n\nl3.plot(l_df[:70], \"X\", [\"Sin\", \"Cos\", \"ArcTan\"], lineAttributes, config)\n","user":"anonymous","dateUpdated":"2017-03-30T11:33:33+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python"},"editorMode":"ace/mode/python","title":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866388885_-73060926","id":"20170330-113308_1590486709","dateCreated":"2017-03-30T11:33:08+0200","dateStarted":"2017-03-30T11:33:33+0200","dateFinished":"2017-03-30T11:33:33+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16816"},{"text":"%md\n### b) Append values\n","user":"anonymous","dateUpdated":"2017-03-30T11:58:45+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"markdown","editOnDblClick":true},"editorMode":"ace/mode/markdown","editorHide":true,"tableHide":false},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866433244_-556649778","id":"20170330-113353_928350905","dateCreated":"2017-03-30T11:33:53+0200","dateStarted":"2017-03-30T11:58:45+0200","dateFinished":"2017-03-30T11:58:45+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16817","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h3>b) Append values</h3>\n</div>"}]}},{"title":"","text":"%pyspark\nfor i in range(71,100):\n time.sleep(0.05)\n l3.append(l_df[i:i+1])\n ","user":"anonymous","dateUpdated":"2017-03-30T11:34:16+0200","config":{"enabled":true,"title":false,"results":[],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266858_2021145426","id":"20170315-202947_1120177108","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:34:16+0200","dateFinished":"2017-03-30T11:34:18+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16818"},{"text":"%md\n\n### c) Save it as PNG\n","user":"anonymous","dateUpdated":"2017-03-30T11:58:48+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"markdown","editOnDblClick":true},"editorMode":"ace/mode/markdown","editorHide":true,"tableHide":false},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866465437_-57969231","id":"20170330-113425_889465080","dateCreated":"2017-03-30T11:34:25+0200","dateStarted":"2017-03-30T11:58:48+0200","dateFinished":"2017-03-30T11:58:48+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16819","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h3>c) Save it as PNG</h3>\n</div>"}]}},{"text":"%pyspark\nl3.saveAsPng(\"line.png\", backgroundColor=\"white\")\n","user":"anonymous","dateUpdated":"2017-03-30T11:34:43+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python"},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866464573_-1202981958","id":"20170330-113424_1799907693","dateCreated":"2017-03-30T11:34:24+0200","dateStarted":"2017-03-30T11:34:43+0200","dateFinished":"2017-03-30T11:34:43+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16820"},{"text":"%md\n\n### d) Multiplie independent lines\n","user":"anonymous","dateUpdated":"2017-03-30T11:58:50+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"markdown","editOnDblClick":true},"editorMode":"ace/mode/markdown","editorHide":true,"tableHide":false},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866500668_-360519784","id":"20170330-113500_838245119","dateCreated":"2017-03-30T11:35:00+0200","dateStarted":"2017-03-30T11:58:50+0200","dateFinished":"2017-03-30T11:58:50+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16821","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h3>d) Multiplie independent lines</h3>\n</div>"}]}},{"text":"%pyspark\n# data taken from scikit-learn http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html\n\ndata = {'FPR': [0.0000,0.0000,0.0196,0.0196,0.0784,0.0784,0.0980,0.0980,0.1176,0.1176,0.1373,\n 0.1373,0.1569,0.1569,0.1765,0.1765,0.3137,0.3137,0.3333,0.3333,0.3529,0.3529,\n 0.4118,0.4118,0.4510,0.4510,0.4706,0.4706,0.5098,0.5098,0.5686,0.5686,1.0000],\n 'TPR': [0.0417,0.1250,0.1250,0.2500,0.2500,0.2917,0.2917,0.3333,0.3333,0.4167,0.4167,\n 0.5000,0.5000,0.5417,0.5417,0.5833,0.5833,0.6667,0.6667,0.7500,0.7500,0.7917,\n 0.7917,0.8333,0.8333,0.8750,0.8750,0.9167,0.9167,0.9583,0.9583,1.0000,1.0000]}\n\nconfig = {\"width\":600, \"height\":500, \"color\":nv.c20(2,1), \"useInteractiveGuideline\":True,\n \"xDomain\":[0,1], \"yDomain\":[0,1.05],\n \"xAxis\":{\"axisLabel\":\"False Positive Rate\"},\n \"yAxis\":{\"axisLabel\":\"True Positive Rate\"}\n }\n\ndisplay(html=[(\"ROC\", 300)], style=\"h3\")\n\nroc = nv.lineChart()\nroc.addLine(data, \"FPR\", \"TPR\")\nroc.addLine({\"X\":[0,1], \"Threshold\":[0,1]}, \"X\", \"Threshold\", lineAttributes={\"style\":\"dotted\"})\nroc.plot(config=config)\n","user":"anonymous","dateUpdated":"2017-03-30T11:36:57+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python"},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866499564_-1228513303","id":"20170330-113459_2046298068","dateCreated":"2017-03-30T11:34:59+0200","dateStarted":"2017-03-30T11:36:57+0200","dateFinished":"2017-03-30T11:36:57+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16822"},{"text":"%md\n\n### e) Add a focus selector\n","user":"anonymous","dateUpdated":"2017-03-30T11:58:54+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"markdown","editOnDblClick":true},"editorMode":"ace/mode/markdown","editorHide":true,"tableHide":false},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866634009_-570391825","id":"20170330-113714_541090611","dateCreated":"2017-03-30T11:37:14+0200","dateStarted":"2017-03-30T11:58:54+0200","dateFinished":"2017-03-30T11:58:54+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16823","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h3>e) Add a focus selector</h3>\n</div>"}]}},{"title":"","text":"%pyspark\nl2 = nv.lineChart()\n\nconfig={\"height\":500, \"width\": 1024,\n \"focusEnable\": True, \"color\":nv.c10(), \n \"yAxis\": {\"axisLabel\":\"f(x)\", \"tickFormat\":\",.2f\"}, \n \"xAxis\":{\"axisLabel\":\"x\", \"tickFormat\":\"%d-%m-%Y\"}}\n\nlineAttributes={\"area\":[True, False, True], \"fillOpacity\":[0.2, 0, 0.2], \"style\":[\"dashed\", \"dotted\", None]}\n\nl2.plot(l_df, \"X\", [\"Sin\", \"Cos\", \"ArcTan\"], lineAttributes, config)\n","user":"anonymous","dateUpdated":"2017-03-30T11:37:36+0200","config":{"enabled":true,"title":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266859_2020760678","id":"20170315-110436_827257444","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:37:36+0200","dateFinished":"2017-03-30T11:37:36+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16824"},{"text":"%md\n\n## 3 Discrete Bar Chart\n\n### a) Plot\n","user":"anonymous","dateUpdated":"2017-03-30T11:58:56+0200","config":{"enabled":true,"tableHide":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/markdown","editorHide":true,"editorSetting":{"language":"markdown","editOnDblClick":true},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266860_2018836933","id":"20170313-161159_1872898339","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:58:56+0200","dateFinished":"2017-03-30T11:58:56+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16825","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>3 Discrete Bar Chart</h2>\n<h3>a) Plot</h3>\n</div>"}]}},{"text":"%pyspark\ndb_df = pd.DataFrame(iris.loc[:, [\"SepalLength\", \"SepalWidth\", \"PetalLength\", \"PetalWidth\"]].mean()).reset_index()\ndb_df.columns = [\"Series\", \"Mean\"]\n\ndb = nv.discreteBarChart()\n\nconfig={\"height\": 350, \"width\": 500, \"color\": nv.c20(), \"staggerLabels\": False}\n\ndb.plot(db_df[:2], key=\"Series\", value=\"Mean\", config=config)","user":"anonymous","dateUpdated":"2017-03-30T11:38:04+0200","config":{"enabled":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266861_2018452184","id":"20170313-135356_2058840965","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:38:04+0200","dateFinished":"2017-03-30T11:38:04+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16826"},{"text":"%md\n\n### b) Append values\n","user":"anonymous","dateUpdated":"2017-03-30T11:59:17+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"markdown","editOnDblClick":true},"editorMode":"ace/mode/markdown","editorHide":true,"tableHide":false},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866689207_1323585804","id":"20170330-113809_1220510522","dateCreated":"2017-03-30T11:38:09+0200","dateStarted":"2017-03-30T11:59:17+0200","dateFinished":"2017-03-30T11:59:17+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16827","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h3>b) Append values</h3>\n</div>"}]}},{"text":"%pyspark\ndb.append(db_df[2:])\n","user":"anonymous","dateUpdated":"2017-03-30T11:38:27+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python"},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866688744_1487873584","id":"20170330-113808_945132297","dateCreated":"2017-03-30T11:38:08+0200","dateStarted":"2017-03-30T11:38:27+0200","dateFinished":"2017-03-30T11:38:27+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16828"},{"text":"%md\n\n## 4 Multi Bar Chart\n\n### a) Plot","user":"anonymous","dateUpdated":"2017-03-30T11:59:19+0200","config":{"enabled":true,"tableHide":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/markdown","editorHide":true,"editorSetting":{"language":"markdown","editOnDblClick":true},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266861_2018452184","id":"20170313-161527_449359810","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:59:19+0200","dateFinished":"2017-03-30T11:59:19+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16829","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>4 Multi Bar Chart</h2>\n<h3>a) Plot</h3>\n</div>"}]}},{"text":"%pyspark\nx = np.linspace(0, 4*np.pi, 10)\nmb_df = pd.DataFrame({\"X\":x, \"Sin\":np.sin(x), \"Cos\":np.cos(x), \"ArcTan\":np.arctan(x-2*np.pi)/3})\n\nmb1 = nv.multiBarChart()\n\nconfig = {\"height\":500, \"width\": 800, \n \"color\": nv.c20(),\n \"xAxis\":{\"axisLabel\":\"x\", \"tickFormat\":\",.2f\"},\n \"yAxis\":{\"axisLabel\":\"f(x)\", \"tickFormat\":\",.2f\"}}\n\nmb1.plot(mb_df[:6], \"X\", [\"Sin\", \"Cos\", \"ArcTan\"], config)\n","user":"anonymous","dateUpdated":"2017-03-30T11:39:32+0200","config":{"enabled":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266862_2019606431","id":"20170313-141626_973367084","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:39:32+0200","dateFinished":"2017-03-30T11:39:32+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16830"},{"text":"%md\n### b) Append values\n","user":"anonymous","dateUpdated":"2017-03-30T11:59:24+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"markdown","editOnDblClick":true},"editorMode":"ace/mode/markdown","editorHide":true,"tableHide":false},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866777294_-906095369","id":"20170330-113937_1717129156","dateCreated":"2017-03-30T11:39:37+0200","dateStarted":"2017-03-30T11:59:24+0200","dateFinished":"2017-03-30T11:59:24+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16831","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h3>b) Append values</h3>\n</div>"}]}},{"text":"%pyspark\nfor i in range(6,10):\n time.sleep(0.5)\n mb1.append(mb_df[i:i+1])\n ","user":"anonymous","dateUpdated":"2017-03-30T11:40:02+0200","config":{"enabled":true,"results":[],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266863_2019221682","id":"20170315-204923_222151667","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:40:02+0200","dateFinished":"2017-03-30T11:40:04+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16832"},{"text":"%md\n## 5 Multi Bar Horizontal Chart\n\n### a) Plot","user":"anonymous","dateUpdated":"2017-03-30T11:59:26+0200","config":{"enabled":true,"tableHide":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/markdown","editorHide":true,"editorSetting":{"language":"markdown","editOnDblClick":true},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266863_2019221682","id":"20170315-191243_1253869324","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:59:26+0200","dateFinished":"2017-03-30T11:59:26+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16833","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>5 Multi Bar Horizontal Chart</h2>\n<h3>a) Plot</h3>\n</div>"}]}},{"text":"%pyspark\nmbh = nv.multiBarHorizontalChart()\n\nconfig = {\"height\":500, \"width\": 800, \"color\":nv.c20()[10:], \"stacked\":False}\n\nmbh.plot(mb_df[:6], \"X\", [\"Sin\", \"Cos\", \"ArcTan\"], config)\n","user":"anonymous","dateUpdated":"2017-03-30T11:40:29+0200","config":{"enabled":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266864_2029609902","id":"20170315-191210_99140198","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:40:29+0200","dateFinished":"2017-03-30T11:40:29+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16834"},{"text":"%md\n\n### b) Append values\n","user":"anonymous","dateUpdated":"2017-03-30T11:59:29+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"markdown","editOnDblClick":true},"editorMode":"ace/mode/markdown","editorHide":true,"tableHide":false},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866835306_1532351215","id":"20170330-114035_1169117059","dateCreated":"2017-03-30T11:40:35+0200","dateStarted":"2017-03-30T11:59:29+0200","dateFinished":"2017-03-30T11:59:29+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16835","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h3>b) Append values</h3>\n</div>"}]}},{"text":"%pyspark\nmbh.append(mb_df[6:])\n","user":"anonymous","dateUpdated":"2017-03-30T11:40:56+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python"},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866834236_1954805507","id":"20170330-114034_141240038","dateCreated":"2017-03-30T11:40:34+0200","dateStarted":"2017-03-30T11:40:56+0200","dateFinished":"2017-03-30T11:40:56+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16836"},{"text":"%md\n\n## 6 Line Plus Bar Chart\n### a) Plot","user":"anonymous","dateUpdated":"2017-03-30T11:59:31+0200","config":{"enabled":true,"tableHide":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/markdown","editorHide":true,"editorSetting":{"language":"markdown","editOnDblClick":true},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266865_2029225153","id":"20170313-191140_871106504","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:59:31+0200","dateFinished":"2017-03-30T11:59:31+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16837","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>6 Line Plus Bar Chart</h2>\n<h3>a) Plot</h3>\n</div>"}]}},{"title":"Load HDP historical Stock data","text":"%pyspark\n\nohlcDf = downloadHistoricalStockData('AAPL', (2016,3,28), (2017,3,27))\nohlcDf[\"VolumeMio\"] = ohlcDf[\"Volume\"] / 10000000\nohlcDf.head(10)\n","user":"anonymous","dateUpdated":"2017-03-30T11:47:17+0200","config":{"enabled":true,"title":true,"results":[],"editorMode":"ace/mode/python","editorSetting":{"language":"python","editOnDblClick":false},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266865_2029225153","id":"20170319-170538_1457149481","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:47:17+0200","dateFinished":"2017-03-30T11:47:19+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16838"},{"text":"%pyspark\nlpb = nv.linePlusBarChart()\n\nconfig={\"color\":[nv.c20()[0], nv.c20()[3]], \n \"height\":600, \"width\":1200,\n \"xAxis\":{\"tickFormat\":\"%d.%m.%y\"},\n \"x2Axis\":{\"tickFormat\":\"%d.%m.%y\"},\n \"yDomain\":[80, 145],\n \"duration\":0, \"focusEnable\":True\n}\n\nlpb.plot(ohlcDf[0:300], \"Timestamp\", lineValue=\"Close\", barValue=\"Volume\", config=config)\n\n","user":"anonymous","dateUpdated":"2017-03-30T11:47:22+0200","config":{"enabled":true,"results":[{"graph":{"mode":"table","height":604,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266866_2030379400","id":"20170315-195902_1844525573","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:47:22+0200","dateFinished":"2017-03-30T11:47:23+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16839"},{"text":"%md\n\n### b) Append values\n","user":"anonymous","dateUpdated":"2017-03-30T11:59:35+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"markdown","editOnDblClick":true},"editorMode":"ace/mode/markdown","editorHide":true,"tableHide":false},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866939963_1955311205","id":"20170330-114219_2123276950","dateCreated":"2017-03-30T11:42:19+0200","dateStarted":"2017-03-30T11:59:35+0200","dateFinished":"2017-03-30T11:59:35+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16840","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h3>b) Append values</h3>\n</div>"}]}},{"text":"%pyspark\nfor i in range(301,len(ohlcDf), 5):\n time.sleep(0.5)\n lpb.append(ohlcDf[i:i+5])\n ","user":"anonymous","dateUpdated":"2017-03-30T11:47:26+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python"},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490866942123_-1508598467","id":"20170330-114222_1943492650","dateCreated":"2017-03-30T11:42:22+0200","dateStarted":"2017-03-30T11:47:26+0200","dateFinished":"2017-03-30T11:47:33+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16841"},{"text":"%md\n\n## 7 Pie Chart\n\n### a) Plot","user":"anonymous","dateUpdated":"2017-03-30T11:59:37+0200","config":{"enabled":true,"tableHide":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/markdown","editorHide":true,"editorSetting":{"language":"markdown","editOnDblClick":true},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266867_2029994651","id":"20170313-161705_1238509298","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:59:37+0200","dateFinished":"2017-03-30T11:59:37+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16842","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>7 Pie Chart</h2>\n<h3>a) Plot</h3>\n</div>"}]}},{"text":"%pyspark\np1 = nv.pieChart()\np1.plot(db_df, \"Series\", \"Mean\", config={\"height\":300, \"width\":260})\n","user":"anonymous","dateUpdated":"2017-03-30T11:49:35+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python","editOnDblClick":false},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490867357092_1160249767","id":"20170330-114917_551453660","dateCreated":"2017-03-30T11:49:17+0200","dateStarted":"2017-03-30T11:49:35+0200","dateFinished":"2017-03-30T11:49:35+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16843"},{"text":"%pyspark\np2 = nv.pieChart()\n\nconfig1={\"donut\": False, \"color\": nv.c10(), \"width\": 300, \"height\":400}\nconfig2={\"donut\": True, \"color\": nv.c20(), \"width\": 300, \"height\":400}\nconfig3={\"donut\": True, \"halfPie\": True, \"color\": nv.c20b(), \"width\": 300, \"height\":400}\n\np2.hplot([p2.chart(db_df[:2], \"Series\", \"Mean\", config=config1), \n p2.chart(db_df[:2], \"Series\", \"Mean\", config=config2), \n p2.chart(db_df[:2], \"Series\", \"Mean\", config=config3)])","user":"anonymous","dateUpdated":"2017-03-30T11:49:58+0200","config":{"enabled":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python","editOnDblClick":false},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266868_2028070907","id":"20170317-155013_1327062227","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:49:58+0200","dateFinished":"2017-03-30T11:49:58+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16844"},{"text":"%md\n### b) Append values\n","user":"anonymous","dateUpdated":"2017-03-30T11:59:41+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"markdown","editOnDblClick":true},"editorMode":"ace/mode/markdown","editorHide":true,"tableHide":false},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490867404344_-800183797","id":"20170330-115004_469761686","dateCreated":"2017-03-30T11:50:04+0200","dateStarted":"2017-03-30T11:59:41+0200","dateFinished":"2017-03-30T11:59:41+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16845","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h3>b) Append values</h3>\n</div>"}]}},{"text":"%pyspark\nfor chart in range(3):\n p2.append(db_df[2:], chart=chart)\n ","user":"anonymous","dateUpdated":"2017-03-30T11:50:21+0200","config":{"enabled":true,"results":[],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266868_2028070907","id":"20170317-155102_2038223657","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:50:21+0200","dateFinished":"2017-03-30T11:50:21+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16846"},{"text":"%md\n\n## 8 Stacked Area Chart\n\n### a) Plot","user":"anonymous","dateUpdated":"2017-03-30T11:59:43+0200","config":{"enabled":true,"tableHide":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/markdown","editorHide":true,"editorSetting":{"language":"markdown","editOnDblClick":true},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266869_2027686158","id":"20170313-161730_1582960156","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:59:43+0200","dateFinished":"2017-03-30T11:59:43+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16847","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>8 Stacked Area Chart</h2>\n<h3>a) Plot</h3>\n</div>"}]}},{"text":"%pyspark\ncount = 100\ngroups = 5\n\nseries = []\nfor i in range(groups):\n factor = np.random.randint(5,10)\n offset = np.random.randint(20,100)\n series.append(randomWalk(count, 20, offset).tolist())\n\nsa_df = pd.DataFrame([lastDays(count, epoch=True)] + series).T\nsa_df.columns = [\"Date\"] + [\"Series %d\" % i for i in range(groups)]\nsa_df.head(2)\n","user":"anonymous","dateUpdated":"2017-03-30T11:51:21+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python","editOnDblClick":false},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490867467305_-1231440818","id":"20170330-115107_475140843","dateCreated":"2017-03-30T11:51:07+0200","dateStarted":"2017-03-30T11:51:21+0200","dateFinished":"2017-03-30T11:51:21+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16848"},{"text":"%pyspark\nsa = nv.stackedAreaChart()\n\nconfig={\"color\": nv.c20(), \"height\":500, \"xAxis\":{\"tickFormat\":\"%d.%m.%Y\"}, \"duration\":0}\n\nsa.plot(sa_df[:80], \"Date\", [\"Series %d\" % i for i in range(groups)], config=config)\n","user":"anonymous","dateUpdated":"2017-03-30T11:59:46+0200","config":{"enabled":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266870_2028840404","id":"20170314-164321_1267288478","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:59:46+0200","dateFinished":"2017-03-30T11:59:46+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16849"},{"text":"%md\n### b) Append values\n","user":"anonymous","dateUpdated":"2017-03-30T11:59:54+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"markdown","editOnDblClick":true},"editorMode":"ace/mode/markdown","editorHide":true,"tableHide":false},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490867496696_1599218137","id":"20170330-115136_1185205821","dateCreated":"2017-03-30T11:51:36+0200","dateStarted":"2017-03-30T11:59:54+0200","dateFinished":"2017-03-30T11:59:54+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16850","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h3>b) Append values</h3>\n</div>"}]}},{"text":"%pyspark\nfor i in range(80, 100, 2):\n time.sleep(0.1)\n sa.append(sa_df[i:i+2])","user":"anonymous","dateUpdated":"2017-03-30T11:51:58+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python"},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490867495861_2117474905","id":"20170330-115135_1575768435","dateCreated":"2017-03-30T11:51:35+0200","dateStarted":"2017-03-30T11:51:58+0200","dateFinished":"2017-03-30T11:52:00+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16851"},{"text":"%md\n\n## 9 Scatter Plus Line Chart\n\n### a) Plot\n","user":"anonymous","dateUpdated":"2017-03-30T11:59:57+0200","config":{"enabled":true,"tableHide":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/markdown","editorHide":true,"editorSetting":{"language":"markdown","editOnDblClick":true},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266871_2028455656","id":"20170313-191509_1852804097","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:59:57+0200","dateFinished":"2017-03-30T11:59:57+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16852","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>9 Scatter Plus Line Chart</h2>\n<h3>a) Plot</h3>\n</div>"}]}},{"text":"%pyspark\nspl_df = pd.DataFrame({chr(65+i): randomNormalList(40, 4, 1) for i in range(4)})\nspl_df[\"S1\"] = \"diamond\"\nspl_df[\"S2\"] = \"square\"\nspl_df.head(2)\n","user":"anonymous","dateUpdated":"2017-03-30T11:52:38+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python","editOnDblClick":false},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490867543047_159349835","id":"20170330-115223_1936931123","dateCreated":"2017-03-30T11:52:23+0200","dateStarted":"2017-03-30T11:52:38+0200","dateFinished":"2017-03-30T11:52:38+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16853"},{"text":"%pyspark\n# ScatterPlusLineChart has an issue with lines in Jupyter and Zeppelin from 1.8.3 onwards, so switch to 1.8.2\nnv.reloadNVD3(\"1.8.2\")\n","user":"anonymous","dateUpdated":"2017-03-30T11:52:57+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python"},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490867570566_-1975960588","id":"20170330-115250_1748290922","dateCreated":"2017-03-30T11:52:50+0200","dateStarted":"2017-03-30T11:52:57+0200","dateFinished":"2017-03-30T11:52:57+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16854"},{"text":"%pyspark\nspl1 = nv.scatterPlusLineChart()\n\nconfig = {\"color\":nv.c10(), \n \"xDomain\":[0, 8], \"xAxis\":{\"axisLabel\":\"A: squares, C: diamonds\"},\n \"yDomain\":[0, 8]}\n\ndata = spl1.plot(spl_df[:30], keys=[\"A\", \"C\"], values=[\"B\", \"D\"], pointAttributes={\"shapes\":[\"S1\", \"S2\"]},\n lines=[{\"slope\":1.0, \"intercept\":-1.0}, {\"slope\":-0.6, \"intercept\":6.0}], config=config)\n ","user":"anonymous","dateUpdated":"2017-03-30T11:53:09+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python"},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490867569584_-1587364199","id":"20170330-115249_1637872548","dateCreated":"2017-03-30T11:52:49+0200","dateStarted":"2017-03-30T11:53:09+0200","dateFinished":"2017-03-30T11:53:09+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16855"},{"text":"%md\n### b) Append values\n","user":"anonymous","dateUpdated":"2017-03-30T12:00:01+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"markdown","editOnDblClick":true},"editorMode":"ace/mode/markdown","editorHide":true,"tableHide":false},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490867594765_191576798","id":"20170330-115314_232665331","dateCreated":"2017-03-30T11:53:14+0200","dateStarted":"2017-03-30T12:00:01+0200","dateFinished":"2017-03-30T12:00:01+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16856","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h3>b) Append values</h3>\n</div>"}]}},{"text":"%pyspark\nfor i in range(30,40):\n time.sleep(0.5)\n spl1.append(spl_df[i:i+1], \n lines=[{\"slope\":30.0/i, \"intercept\":-1.0}, {\"slope\":-20.0/i, \"intercept\":6.0}])\n ","user":"anonymous","dateUpdated":"2017-03-30T11:53:33+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python"},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490867593927_614031090","id":"20170330-115313_1994565692","dateCreated":"2017-03-30T11:53:13+0200","dateStarted":"2017-03-30T11:53:33+0200","dateFinished":"2017-03-30T11:53:39+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16857"},{"text":"%md\n### c) Example","user":"anonymous","dateUpdated":"2017-03-30T12:00:05+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"markdown","editOnDblClick":true},"editorMode":"ace/mode/markdown","editorHide":true,"tableHide":false},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490867621863_228543340","id":"20170330-115341_1377437748","dateCreated":"2017-03-30T11:53:41+0200","dateStarted":"2017-03-30T12:00:05+0200","dateFinished":"2017-03-30T12:00:05+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16858","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h3>c) Example</h3>\n</div>"}]}},{"text":"%pyspark\nfrom sklearn import linear_model\n\nsetosa = iris[iris.Name == \"Iris-setosa\"]\nversicolor = iris[iris.Name == \"Iris-versicolor\"]\nvirginica = iris[iris.Name == \"Iris-virginica\"]\n\ndef linReg(x,y):\n regr = linear_model.LinearRegression()\n regr.fit(x,y)\n return (regr.coef_.item(0), regr.intercept_.item(0))\n \ndef prepare(df, name):\n sepal = df.loc[:,[\"SepalLength\", \"SepalWidth\"]]\n sepal.columns = [\"X\", name]\n sepal[\"Shape\"] = \"diamond\"\n petal = df.loc[:,[\"PetalLength\", \"PetalWidth\"]]\n petal.columns = [\"X\", name]\n petal[\"Shape\"] = \"square\"\n \n df = pd.concat([sepal, petal])\n x = df[\"X\"].values.reshape(df.shape[0], 1)\n y = df[name].values.reshape(df.shape[0], 1)\n slope, intercept = linReg(x,y)\n\n df[\"Size\"] = 2\n df = df.groupby([\"Shape\", \"X\", name]).sum().reset_index()\n return (df, slope, intercept)\n\nsetosaDf, setosaSlope, setosaIntercept = prepare(setosa, \"Setosa\")\nvirginicaDf, virginicaSlope, virginicaIntercept = prepare(virginica, \"Virginica\")\nversicolorDf, versicolorSlope, versicolorIntercept = prepare(versicolor, \"Versicolor\")\n\n","user":"anonymous","dateUpdated":"2017-03-30T11:54:28+0200","config":{"enabled":true,"results":[],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266872_2026531911","id":"20170316-203241_616587572","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:54:28+0200","dateFinished":"2017-03-30T11:54:30+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16859"},{"text":"%pyspark\nspl2 = nv.scatterPlusLineChart()\n\nconfig = {\"height\":700, #\"xDomain\":[0,8], \"yDomain\":[0,4.5],\n \"xAxis\":{\"axisLabel\":\"Length (sepal=diamond, petal=square)\"}, \"yAxis\":{\"axisLabel\":\"Width (sepal=diamond, petal=square)\"}\n}\n\nspl2.addScatter(setosaDf, \"X\", \"Setosa\", lines={\"slope\":setosaSlope, \"intercept\":setosaIntercept}, \n pointAttributes={\"shapes\":\"Shape\", \"sizes\":\"Size\"})\nspl2.addScatter(virginicaDf, \"X\", \"Virginica\", lines={\"slope\":virginicaSlope, \"intercept\":virginicaIntercept}, \n pointAttributes={\"shapes\":\"Shape\", \"sizes\":\"Size\"})\nspl2.addScatter(versicolorDf, \"X\", \"Versicolor\", lines={\"slope\":versicolorSlope, \"intercept\":versicolorIntercept}, \n pointAttributes={\"shapes\":\"Shape\", \"sizes\":\"Size\"})\n\nspl2.plot(config=config)\n\n","user":"anonymous","dateUpdated":"2017-03-30T11:54:50+0200","config":{"enabled":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266873_2026147162","id":"20170316-205700_1807352313","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:54:50+0200","dateFinished":"2017-03-30T11:54:50+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16860"},{"text":"%pyspark\n# Switch back to 1.8.5\nnv.reloadNVD3(\"1.8.5\")","user":"anonymous","dateUpdated":"2017-03-30T11:55:06+0200","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python"},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490867698573_-1475216734","id":"20170330-115458_1594783956","dateCreated":"2017-03-30T11:54:58+0200","dateStarted":"2017-03-30T11:55:06+0200","dateFinished":"2017-03-30T11:55:06+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16861"},{"text":"%md\n\n## 10 Parallel Coordinates Plot\n","user":"anonymous","dateUpdated":"2017-03-30T12:00:12+0200","config":{"enabled":true,"tableHide":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/markdown","editorHide":true,"editorSetting":{"language":"markdown","editOnDblClick":true},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266874_2027301409","id":"20170316-172843_902403708","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T12:00:12+0200","dateFinished":"2017-03-30T12:00:12+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16862","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>10 Parallel Coordinates Plot</h2>\n</div>"}]}},{"text":"%pyspark\niris.loc[iris.Name==\"Iris-setosa\", \"color\"] = nv.c10()[0]\niris.loc[iris.Name==\"Iris-versicolor\", \"color\"] = nv.c10()[1]\niris.loc[iris.Name==\"Iris-virginica\", \"color\"] = nv.c10()[2]\niris[\"strokeWidth\"] = 0.5\niris.head()\n","user":"anonymous","dateUpdated":"2017-03-30T11:55:18+0200","config":{"enabled":true,"results":[],"editorMode":"ace/mode/python","editorSetting":{"language":"python","editOnDblClick":false},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266875_2026916660","id":"20170317-163754_2048422860","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:55:18+0200","dateFinished":"2017-03-30T11:55:18+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16863"},{"text":"%pyspark\npc = nv.parallelCoordinatesChart()\n\nconfig = {\"height\": 600}\n\npc.plot(iris, 'Name', ['SepalWidth', 'SepalLength', 'PetalWidth', 'PetalLength'],\n lineAttributes=[\"color\", \"strokeWidth\"], \n dimAttributes= {\"format\": [\",.1f\", \",.1f\", \",.1f\", \",.1f\"]},\n config=config)\n ","user":"anonymous","dateUpdated":"2017-03-30T11:55:36+0200","config":{"enabled":true,"tableHide":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorHide":false,"editorSetting":{"language":"python","editOnDblClick":false},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266876_2024992915","id":"20170316-172905_1789805930","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:55:36+0200","dateFinished":"2017-03-30T11:55:36+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16864"},{"text":"%md\n## 11 Historical Bar Chart","user":"anonymous","dateUpdated":"2017-03-30T12:00:15+0200","config":{"enabled":true,"tableHide":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/markdown","editorHide":true,"editorSetting":{"language":"markdown","editOnDblClick":true},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266877_2024608167","id":"20170319-191111_661595190","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T12:00:15+0200","dateFinished":"2017-03-30T12:00:15+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16865","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>11 Historical Bar Chart</h2>\n</div>"}]}},{"text":"%pyspark\nhb = nv.historicalBarChart()\n\nconfig = {\"color\":nv.c20()[4:],\n \"xAxis\":{\"axisLabel\":\"Date (d.m.y)\"},\n \"yAxis\":{\"axisLabel\":\"Volume (Mio)\", \"tickFormat\":\",.2f\"}}\n\nhb.plot(ohlcDf, \"Timestamp\", \"VolumeMio\",config=config)\n","user":"anonymous","dateUpdated":"2017-03-30T11:56:00+0200","config":{"enabled":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266878_2025762413","id":"20170319-191109_2147365765","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:56:00+0200","dateFinished":"2017-03-30T11:56:00+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16866"},{"text":"%md\n## 12 Candlestick Chart\n","user":"anonymous","dateUpdated":"2017-03-30T12:00:18+0200","config":{"enabled":true,"tableHide":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/markdown","editorHide":true,"editorSetting":{"language":"markdown","editOnDblClick":true},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266879_2025377664","id":"20170319-191103_1734338169","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T12:00:18+0200","dateFinished":"2017-03-30T12:00:18+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16867","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>12 Candlestick Chart</h2>\n</div>"}]}},{"text":"%pyspark\ncs = nv.candlestickBarChart()\n\nconfig = {\"color\":nv.c10(), \"yDomain\":[114,145], \"width\":1400, \"height\":800,\n \"xAxis\":{\"tickFormat\":\"%d/%m/%Y\", \"axisLabel\":\"Date (d/m/y)\"},\n \"yAxis\":{\"axisLabel\":\"Close (USD)\"}}\n\nohlcAttribs = {\"open\":\"Open\" ,\"high\":\"High\" ,\"low\":\"Low\" ,\"volume\":\"Volume\" ,\"adjusted\":\"Adj_Close\"}\n\ncs.plot(ohlcDf[-80:], \"Timestamp\", \"Close\", ohlcAttribs, config=config)\n","user":"anonymous","dateUpdated":"2017-03-30T11:56:15+0200","config":{"enabled":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266879_2025377664","id":"20170319-191101_926228226","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:56:15+0200","dateFinished":"2017-03-30T11:56:16+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16868"},{"text":"%md\n## 13 OHLC Chart\n","user":"anonymous","dateUpdated":"2017-03-30T12:00:21+0200","config":{"enabled":true,"tableHide":false,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/markdown","editorHide":true,"editorSetting":{"language":"markdown","editOnDblClick":true},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266880_2011141955","id":"20170319-191226_72836656","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T12:00:21+0200","dateFinished":"2017-03-30T12:00:21+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16869","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>13 OHLC Chart</h2>\n</div>"}]}},{"text":"%pyspark\nohlc = nv.ohlcBarChart()\n\nconfig = {\"color\":nv.c10(), \"yDomain\":[114,145], \"width\":1400, \"height\":800,\n \"xAxis\":{\"tickFormat\":\"%d/%m/%Y\", \"axisLabel\":\"Date (d/m/y)\"},\n \"yAxis\":{\"axisLabel\":\"Close (USD)\"}}\n\nohlcAttribs = {\"open\":\"Open\" ,\"high\":\"High\" ,\"low\":\"Low\" ,\"volume\":\"Volume\" ,\"adjusted\":\"Adj_Close\"}\n\nohlc.plot(ohlcDf[-90:], \"Timestamp\", \"Close\", ohlcAttribs, config=config)\n","user":"anonymous","dateUpdated":"2017-03-30T11:56:34+0200","config":{"enabled":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266881_2010757206","id":"20170319-191224_1426162299","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:56:34+0200","dateFinished":"2017-03-30T11:56:34+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16870"},{"text":"%md\n## 14 Bullet Chart","user":"anonymous","dateUpdated":"2017-03-30T12:00:24+0200","config":{"enabled":true,"tableHide":false,"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}},"results":{},"editorMode":"ace/mode/markdown","editorHide":true,"editorSetting":{"language":"markdown","editOnDblClick":true},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266882_2011911453","id":"20170315-191652_1355138106","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T12:00:24+0200","dateFinished":"2017-03-30T12:00:24+0200","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:16871","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<div class=\"markdown-body\">\n<h2>14 Bullet Chart</h2>\n</div>"}]}},{"text":"%pyspark\ndef getData(title, actual, previous):\n return {\"title\":title, \"subtitle\":\"out of 5\",\n \"ranges\":{'Bad':3.5, 'OK':4.25, 'Good':5},\n \"measure\":{'Current':actual},\n \"markers\":{'Previous':previous},\n \"markerLines\":{'Threshold':3.0, 'Target':4.4}}\n \nb1 = nv.bulletChart()\n\nconfig = {\"height\":60, \"width\":600}\n\nb1.vplot([b1.chart(config=config, **getData(\"Satisfaction\", 3.9, 3.8)),\n b1.chart(config=config, **getData(\"Satisfaction\", 4.3, 3.8))])\n ","user":"anonymous","dateUpdated":"2017-03-30T11:57:10+0200","config":{"enabled":true,"results":[{"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}}}],"editorMode":"ace/mode/python","editorSetting":{"language":"python"},"colWidth":12},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266884_2009602959","id":"20170313-192847_1448520572","dateCreated":"2017-03-30T11:14:26+0200","dateStarted":"2017-03-30T11:57:10+0200","dateFinished":"2017-03-30T11:57:10+0200","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16872"},{"dateUpdated":"2017-03-30T11:14:26+0200","config":{"enabled":true,"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}},"editorMode":"ace/mode/scala","colWidth":12,"results":{},"editorSetting":{"language":"scala"}},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1490865266886_2010372457","id":"20170320-155718_1902289560","dateCreated":"2017-03-30T11:14:26+0200","status":"READY","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:16873"}],"name":"Zeppelin-Nvd3-Demo","id":"2CCNFP3KP","angularObjects":{"2CDNFBMGA:shared_process":[],"2CCZEM8GY:shared_process":[],"2CCEZZU57:shared_process":[],"2CEPA7GWA:shared_process":[],"2CDEZTV3Y:shared_process":[],"2CBTVUKD8:shared_process":[],"2CDQ1TN3G:shared_process":[],"2CBJ3JDPV:shared_process":[],"2CDADYZPC:shared_process":[],"2CDMAWYTG:shared_process":[],"2CCPMSEBH:shared_process":[],"2CBDN5VDU:shared_process":[{"name":"__zeppelin_comm_2CCNFP3KP_msg__","object":{"id":130,"task":"call","msg":{"object":{"event":"plot","data":{"data":{"title":"Satisfaction","markers":[3.8],"markerLabels":["Previous"],"ranges":[4.25,5,3.5],"subtitle":"out of 5","markerLineLabels":["Threshold","Target"],"measureLabels":["Current"],"measures":[4.3],"rangeLabels":["OK","Good","Bad"],"markerLines":[3,4.4]},"config":{"height":60,"width":600}},"plotId":"bulletChart-040"},"delay":200,"function":"bulletChart"}},"noteId":"2CCNFP3KP"},{"name":"__zeppelin_comm_2CCNFP3KP_status__","object":"ZeppelinSession started (do not delete this paragraph)","noteId":"2CCNFP3KP"}],"2CBXVZ89X:shared_process":[],"2CC1G649T:shared_process":[],"2CEQTHQNU:shared_process":[],"2CE2HBWUD:shared_process":[],"2CEJFVVJM:shared_process":[],"2CET6ZSSR:shared_process":[],"2CC5X9SE4:shared_process":[]},"config":{"looknfeel":"default","personalizedMode":"false"},"info":{}}